]> git.sesse.net Git - ffmpeg/commitdiff
avformat/flvdec: Use av_sat_add64() for pts computation
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 14 Jan 2021 21:02:50 +0000 (22:02 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 23 Jan 2021 13:32:54 +0000 (14:32 +0100)
Fixes: signed integer overflow: -9223372036854767583 + -65536 cannot be represented in type 'long'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_FLV_fuzzer-6734549467922432
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/flvdec.c

index ad6e7a3ca5ace4d0a3f1f935b41d40b705dac837..07ef342278d5117a3c7c0648d445721c4214537d 100644 (file)
@@ -1231,7 +1231,7 @@ retry_duration:
         if (st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
             // sign extension
             int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000;
-            pts = dts + cts;
+            pts = av_sat_add64(dts, cts);
             if (cts < 0) { // dts might be wrong
                 if (!flv->wrong_dts)
                     av_log(s, AV_LOG_WARNING,