Message ID | 6ac08f29-97f1-89fa-78a0-b1cf7cd5d8b2@googlemail.com |
---|---|
State | Accepted |
Commit | 25012c56448a48487cdc9699465e640871dbcd60 |
Headers | show |
On 11/13/16, Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> wrote: > This prevents a division by zero in read_packet. > > Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> > --- > libavformat/filmstripdec.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > lgtm
On 13.11.2016 18:48, Paul B Mahol wrote: > On 11/13/16, Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> wrote: >> This prevents a division by zero in read_packet. >> >> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> >> --- >> libavformat/filmstripdec.c | 7 +++---- >> 1 file changed, 3 insertions(+), 4 deletions(-) >> > > lgtm Pushed. Best regards, Andreas
diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 414e276..0aeb594 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -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));
This prevents a division by zero in read_packet. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> --- libavformat/filmstripdec.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)