1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2026-05-16 08:38:24 +02:00

filmstripdec: correctly check image dimensions

This prevents a division by zero in read_packet.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 25012c5644)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
Andreas Cadhalpun
2016-11-13 18:22:12 +01:00
parent 028c87be95
commit d8ec9e97b9
+3 -4
View File
@@ -25,6 +25,7 @@
*/ */
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
@@ -68,10 +69,8 @@ static int read_header(AVFormatContext *s)
st->codec->height = avio_rb16(pb); st->codec->height = avio_rb16(pb);
film->leading = avio_rb16(pb); film->leading = avio_rb16(pb);
if (st->codec->width * 4LL * st->codec->height >= INT_MAX) { if (av_image_check_size(st->codec->width, st->codec->height, 0, s) < 0)
av_log(s, AV_LOG_ERROR, "dimensions too large\n"); return AVERROR_INVALIDDATA;
return AVERROR_PATCHWELCOME;
}
avpriv_set_pts_info(st, 64, 1, avio_rb16(pb)); avpriv_set_pts_info(st, 64, 1, avio_rb16(pb));