avformat/oggparsetheora: clip duration within 64bit

Fixes: signed integer overflow: 9079256848778919936 - -288230376151711746 cannot be represented in type 'long'
Fixes: 58248/clusterfuzz-testcase-minimized-ffmpeg_dem_OGG_fuzzer-6326851353313280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/389/head
Michael Niedermayer 2 years ago
parent b168aeb734
commit b1c3d81e71
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 2
      libavformat/oggparsetheora.c

@ -196,7 +196,7 @@ static int theora_packet(AVFormatContext *s, int idx)
if(s->streams[idx]->start_time == AV_NOPTS_VALUE && os->lastpts != AV_NOPTS_VALUE) { if(s->streams[idx]->start_time == AV_NOPTS_VALUE && os->lastpts != AV_NOPTS_VALUE) {
s->streams[idx]->start_time = os->lastpts; s->streams[idx]->start_time = os->lastpts;
if (s->streams[idx]->duration > 0) if (s->streams[idx]->duration > 0)
s->streams[idx]->duration -= s->streams[idx]->start_time; s->streams[idx]->duration = av_sat_sub64(s->streams[idx]->duration, s->streams[idx]->start_time);
} }
} }

Loading…
Cancel
Save