mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/flvdec: Check double before cast in parse_keyframes_index()
Fixes: -2.21166e+304 is outside the range of representable values of type 'long'
Fixes: 29169/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5725452796821504
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 09e5e406c7
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
c747637919
commit
b2c3461b57
|
@ -428,9 +428,13 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, int64_t m
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) {
|
for (i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) {
|
||||||
|
double d;
|
||||||
if (avio_r8(ioc) != AMF_DATA_TYPE_NUMBER)
|
if (avio_r8(ioc) != AMF_DATA_TYPE_NUMBER)
|
||||||
goto invalid;
|
goto invalid;
|
||||||
current_array[0][i] = av_int2double(avio_rb64(ioc));
|
d = av_int2double(avio_rb64(ioc));
|
||||||
|
if (isnan(d) || d < INT64_MIN || d > INT64_MAX)
|
||||||
|
goto invalid;
|
||||||
|
current_array[0][i] = d;
|
||||||
}
|
}
|
||||||
if (times && filepositions) {
|
if (times && filepositions) {
|
||||||
// All done, exiting at a position allowing amf_parse_object
|
// All done, exiting at a position allowing amf_parse_object
|
||||||
|
|
Loading…
Reference in New Issue