mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-10-19 18:03:17 +00:00
avformat/hnm: Check *chunk_size
Fixes: CID1604419 Overflowed constant Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
7e577165c1
commit
291356f58b
1 changed files with 3 additions and 1 deletions
|
@ -114,6 +114,8 @@ static int hnm_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
if (hnm->superchunk_remaining == 0) {
|
if (hnm->superchunk_remaining == 0) {
|
||||||
/* parse next superchunk */
|
/* parse next superchunk */
|
||||||
superchunk_size = avio_rl24(pb);
|
superchunk_size = avio_rl24(pb);
|
||||||
|
if (superchunk_size < 4)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
avio_skip(pb, 1);
|
avio_skip(pb, 1);
|
||||||
|
|
||||||
hnm->superchunk_remaining = superchunk_size - 4;
|
hnm->superchunk_remaining = superchunk_size - 4;
|
||||||
|
@ -124,7 +126,7 @@ static int hnm_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
chunk_id = avio_rl16(pb);
|
chunk_id = avio_rl16(pb);
|
||||||
avio_skip(pb, 2);
|
avio_skip(pb, 2);
|
||||||
|
|
||||||
if (chunk_size > hnm->superchunk_remaining || !chunk_size) {
|
if (chunk_size > hnm->superchunk_remaining || chunk_size < 8) {
|
||||||
av_log(s, AV_LOG_ERROR,
|
av_log(s, AV_LOG_ERROR,
|
||||||
"invalid chunk size: %"PRIu32", offset: %"PRId64"\n",
|
"invalid chunk size: %"PRIu32", offset: %"PRId64"\n",
|
||||||
chunk_size, avio_tell(pb));
|
chunk_size, avio_tell(pb));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue