avformat/wavdec: Check left avio_tell for overflow

Fixes: signed integer overflow: 155 + 9223372036854775655 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5364032278495232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 929ddef3f4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2023-09-30 21:33:34 +02:00
parent 0dd32cf88d
commit ef36359c14
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 2 additions and 0 deletions

View File

@ -765,6 +765,8 @@ smv_out:
goto smv_retry;
return AVERROR_EOF;
}
if (INT64_MAX - left < avio_tell(s->pb))
return AVERROR_INVALIDDATA;
wav->data_end = avio_tell(s->pb) + left;
}