X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Felectronicarts.c;h=3070b05780e52e78143206e4bfa57c298ca7682a;hb=c0b47d1914a19abacdf1edf081cbf07485952920;hp=0fb66970d609ecfaf99c4fa075af1adf3c7123c6;hpb=41a097aada4d45bddb492bb47d64e67423001775;p=ffmpeg diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 0fb66970d60..3070b05780e 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -495,12 +495,17 @@ static int ea_read_packet(AVFormatContext *s, while (!packet_read || partial_packet) { chunk_type = avio_rl32(pb); - chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)) - 8; + chunk_size = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb); + if (chunk_size <= 8) + return AVERROR_INVALIDDATA; + chunk_size -= 8; switch (chunk_type) { /* audio data */ case ISNh_TAG: /* header chunk also contains data; skip over the header portion*/ + if (chunk_size < 32) + return AVERROR_INVALIDDATA; avio_skip(pb, 32); chunk_size -= 32; case ISNd_TAG: