diff options
author | Jan Ekström <jan.ekstrom@24i.com> | 2022-05-06 17:03:04 +0300 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2022-06-30 16:14:05 +0300 |
commit | c9de096851803d45444ae9dfe3a390a2d53ac71b (patch) | |
tree | 74109c1e4aab4654f4ee367a7ba03089730c55a8 | |
parent | 3854c58d9e55ba297b47c1840c159cd39b373b6a (diff) | |
download | ffmpeg-c9de096851803d45444ae9dfe3a390a2d53ac71b.tar.gz |
avformat/movenc: handle OOM situations when parsing AC-3 headers
Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
-rw-r--r-- | libavformat/movenc.c | 5 |
1 files changed, 4 insertions, 1 deletions
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"); |