ffmpeg | branch: master | Jan Ekström <jan.ekst...@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.ekst...@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");

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to