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

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
This commit is contained in:
Jan Ekström 2022-05-06 17:03:04 +03:00 committed by Jan Ekström
parent 3854c58d9e
commit c9de096851

View File

@ -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");