diff mbox series

[FFmpeg-devel,5/7] avformat/flvdec: Use av_sat_add64() for pts computation

Message ID 20210114225116.13486-5-michael@niedermayer.cc
State Accepted
Commit 7a6666b19de1ee01a8d2f10224a8344e7bc1c074
Headers show
Series [FFmpeg-devel,1/7] avformat/ads: Check size | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer Jan. 14, 2021, 10:51 p.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Jan. 23, 2021, 12:14 a.m. UTC | #1
On Thu, Jan 14, 2021 at 11:51:14PM +0100, Michael Niedermayer wrote:
> 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 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index ad6e7a3ca5..07ef342278 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -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,