mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-11-06 13:28:17 +00:00
avformat/matroskadec: prevent duration float-cast-overflow
Reset matroska->duration to 0 if it is negative or if matroska->duration *
matroska->time_scale would exceed INT64_MAX, preventing a float-cast-overflow
when calculating the duration.
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
(cherry picked from commit d42f8d8767)
This commit is contained in:
1 parent
ae19868753
commit
0ba284bbcb
1 file changed
+2
-1
@@ -3490,7 +3490,8 @@ static int matroska_read_header(AVFormatContext *s)
|
||||
|
||||
if (!matroska->time_scale)
|
||||
matroska->time_scale = 1000000;
|
||||
if (isnan(matroska->duration))
|
||||
if (isnan(matroska->duration) || matroska->duration < 0 ||
|
||||
matroska->duration >= (double)INT64_MAX / matroska->time_scale)
|
||||
matroska->duration = 0;
|
||||
if (matroska->duration)
|
||||
matroska->ctx->duration = matroska->duration * matroska->time_scale *
|
||||
|
||||
Reference in new issue
Block a user