History

avformat/rtmpproto: fix rmtp packet leak in gen_connect()

In libavformat/rtmpproto.c:gen_connect(), if check on string length or check on codec fourcc failed, ff_rtmp_packet_create() allocated data in pkt would leak. Add ff_rtmp_packet_destory before return error code.

Lidong Yan committed 1 year ago

Commit b65fece1 parent 0d9f6801 file · +2 −0Browse files

Unified · Split

libavformat/rtmpproto.c+2−0
@@ -347,6 +347,7 @@ static int gen_connect(URLContext *s, RTMPContext *rt) · 346 unmodified lines
347 if ((fourcc_str_len + 1) % 5 != 0) {347 if ((fourcc_str_len + 1) % 5 != 0) {
348 av_log(s, AV_LOG_ERROR, "Malformed rtmp_enhanched_codecs, "348 av_log(s, AV_LOG_ERROR, "Malformed rtmp_enhanched_codecs, "
349 "should be of the form hvc1[,av01][,vp09][,...]\n");349 "should be of the form hvc1[,av01][,vp09][,...]\n");
350 ff_rtmp_packet_destroy(&pkt);
350 return AVERROR(EINVAL);351 return AVERROR(EINVAL);
351 }352 }
352 353
@@ -370,6 +371,7 @@ static int gen_connect(URLContext *s, RTMPContext *rt) · 17 unmodified lines
370 ff_amf_write_string(&p, fourcc);371 ff_amf_write_string(&p, fourcc);
371 } else {372 } else {
372 av_log(s, AV_LOG_ERROR, "Unsupported codec fourcc, %.*s\n", 4, fourcc_data);373 av_log(s, AV_LOG_ERROR, "Unsupported codec fourcc, %.*s\n", 4, fourcc_data);
374 ff_rtmp_packet_destroy(&pkt);
373 return AVERROR_PATCHWELCOME;375 return AVERROR_PATCHWELCOME;
374 }376 }
375 377

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t