Browse Source

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>
tags/n3.2.1
Andreas Cadhalpun 8 years ago
parent
commit
b526958ca4
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      libavformat/filmstripdec.c

+ 3
- 4
libavformat/filmstripdec.c View File

@@ -25,6 +25,7 @@
*/

#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "avformat.h"
#include "internal.h"

@@ -68,10 +69,8 @@ static int read_header(AVFormatContext *s)
st->codecpar->height = avio_rb16(pb);
film->leading = avio_rb16(pb);

if (st->codecpar->width * 4LL * st->codecpar->height >= INT_MAX) {
av_log(s, AV_LOG_ERROR, "dimensions too large\n");
return AVERROR_PATCHWELCOME;
}
if (av_image_check_size(st->codecpar->width, st->codecpar->height, 0, s) < 0)
return AVERROR_INVALIDDATA;

avpriv_set_pts_info(st, 64, 1, avio_rb16(pb));



Loading…
Cancel
Save