Browse Source

Force gif aspect ratio multiplication to 64bit.

Avoids a possible integer overflow.
tags/n2.3
Carl Eugen Hoyos 11 years ago
parent
commit
87f2999641
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      libavformat/gif.c

+ 3
- 2
libavformat/gif.c View File

@@ -33,10 +33,11 @@ static int gif_image_write_header(AVFormatContext *s, int width, int height,
{ {
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVRational sar = s->streams[0]->codec->sample_aspect_ratio; AVRational sar = s->streams[0]->codec->sample_aspect_ratio;
int i, aspect = 0;
int i;
int64_t aspect = 0;


if (sar.num > 0 && sar.den > 0) { if (sar.num > 0 && sar.den > 0) {
aspect = sar.num * 64 / sar.den - 15;
aspect = sar.num * 64LL / sar.den - 15;
if (aspect < 0 || aspect > 255) if (aspect < 0 || aspect > 255)
aspect = 0; aspect = 0;
} }


Loading…
Cancel
Save