[FFmpeg-devel,2/4] avformat/flvenc: Fix leak of oversized packets

Submitted by Andreas Rheinhardt on Oct. 25, 2019, 9:11 a.m.

Details

Message ID 20191025091147.5298-1-andreas.rheinhardt@gmail.com
State New
Headers show

Commit Message

Andreas Rheinhardt Oct. 25, 2019, 9:11 a.m.
Might happen for annex B H.264.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
This patchset was actually meant as a reply to [1], but I made an error
with the in-reply-to headers.

[1]: http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252057.html

 libavformat/flvenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index e327545dcf..0e6c66a5ff 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -990,7 +990,8 @@  static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
     if (size + flags_size >= 1<<24) {
         av_log(s, AV_LOG_ERROR, "Too large packet with size %u >= %u\n",
                size + flags_size, 1<<24);
-        return AVERROR(EINVAL);
+        ret = AVERROR(EINVAL);
+        goto fail;
     }
 
     avio_wb24(pb, size + flags_size);