[FFmpeg-cvslog] avformat/movenc: handle OOM situations when parsing AC-3 headers

Jan Ekström git at videolan.org
Thu Jun 30 16:14:54 EEST 2022


ffmpeg | branch: master | Jan Ekström <jan.ekstrom at 24i.com> | Fri May  6 17:03:04 2022 +0300| [c9de096851803d45444ae9dfe3a390a2d53ac71b] | committer: Jan Ekström

avformat/movenc: handle OOM situations when parsing AC-3 headers

Signed-off-by: Jan Ekström <jan.ekstrom at 24i.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9de096851803d45444ae9dfe3a390a2d53ac71b
---

 libavformat/movenc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 96a34b75b0..a942271beb 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -416,7 +416,10 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track)
     if (!info->pkt && !(info->pkt = av_packet_alloc()))
         return AVERROR(ENOMEM);
 
-    if (avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size) < 0) {
+    if ((ret = avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size) < 0)) {
+        if (ret == AVERROR(ENOMEM))
+            goto end;
+
         /* drop the packets until we see a good one */
         if (!track->entry) {
             av_log(mov->fc, AV_LOG_WARNING, "Dropping invalid packet from start of the stream\n");



More information about the ffmpeg-cvslog mailing list