diff mbox series

[FFmpeg-devel,3/5] avformat/utils: wrap_timestamp() is only needed for less than 64 bits

Message ID 20201107231710.24816-3-michael@niedermayer.cc
State Accepted
Commit b0259aa248e44dcc6960fa340d6377dd80026105
Headers show
Series [FFmpeg-devel,1/5] avformat/tedcaptionsdec: Check for overflow in parse_int() | expand

Checks

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

Commit Message

Michael Niedermayer Nov. 7, 2020, 11:17 p.m. UTC
Fixes: shift exponent 64 is too large for 64-bit type 'unsigned long long'
Fixes: 26497/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-5690188355076096
Fixes: 26903/clusterfuzz-testcase-minimized-ffmpeg_dem_LUODAT_fuzzer-5641466929741824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Jan. 11, 2021, 10:18 p.m. UTC | #1
On Sun, Nov 08, 2020 at 12:17:08AM +0100, Michael Niedermayer wrote:
> Fixes: shift exponent 64 is too large for 64-bit type 'unsigned long long'
> Fixes: 26497/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-5690188355076096
> Fixes: 26903/clusterfuzz-testcase-minimized-ffmpeg_dem_LUODAT_fuzzer-5641466929741824
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 503e583ad0..e4a4e7651b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -101,7 +101,7 @@  static int is_relative(int64_t ts) {
  */
 static int64_t wrap_timestamp(const AVStream *st, int64_t timestamp)
 {
-    if (st->internal->pts_wrap_behavior != AV_PTS_WRAP_IGNORE &&
+    if (st->internal->pts_wrap_behavior != AV_PTS_WRAP_IGNORE && st->pts_wrap_bits < 64 &&
         st->internal->pts_wrap_reference != AV_NOPTS_VALUE && timestamp != AV_NOPTS_VALUE) {
         if (st->internal->pts_wrap_behavior == AV_PTS_WRAP_ADD_OFFSET &&
             timestamp < st->internal->pts_wrap_reference)