aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-04 17:10:38 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-06 20:30:57 +0100
commitcf5945613fc08086e1a7e51f19e69e0877c01165 (patch)
tree3b884471a892581664443a9f6d4e6097ed63fad8
parentd85af33e05cc0a78899eb47d4e300ea3e8008ae7 (diff)
downloadffmpeg-cf5945613fc08086e1a7e51f19e69e0877c01165.tar.gz
avformat/pjsdec: Check duration for overflow
Fixes: signed integer overflow: -3 - 9223372036854775807 cannot be represented in type 'long' Fixes: 17828/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5645915116797952 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 1efaac69328bdc17680924c71be7ec990f0e8f2c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/pjsdec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/pjsdec.c b/libavformat/pjsdec.c
index 5129b70e5f..1c0f753951 100644
--- a/libavformat/pjsdec.c
+++ b/libavformat/pjsdec.c
@@ -55,6 +55,8 @@ static int64_t read_ts(char **line, int *duration)
if (sscanf(*line, "%"SCNd64",%"SCNd64, &start, &end) == 2) {
*line += strcspn(*line, "\"");
*line += !!**line;
+ if (end < start || end - (uint64_t)start > INT_MAX)
+ return AV_NOPTS_VALUE;
*duration = end - start;
return start;
}