From: Andreas Ă–man Date: Sun, 7 Nov 2010 22:43:24 +0000 (+0000) Subject: Avoid division by zero if h264 width and/or height is 0. (Happens on corrupt data) X-Git-Tag: 2.12~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cd90a86100db1871a83073ebf9c08f218173e3d;p=thirdparty%2Ftvheadend.git Avoid division by zero if h264 width and/or height is 0. (Happens on corrupt data) --- diff --git a/src/parser_h264.c b/src/parser_h264.c index 383304900..7f31f2362 100644 --- a/src/parser_h264.c +++ b/src/parser_h264.c @@ -412,10 +412,12 @@ h264_decode_slice_header(th_stream_t *st, bitstream_t *bs, int *pkttype, int w = p->sps[sps_id].aspect_num * st->st_width; int h = p->sps[sps_id].aspect_den * st->st_height; - int d = gcd(w, h); - st->st_aspect_num = w / d; - st->st_aspect_den = h / d; + if(w & h) { + int d = gcd(w, h); + st->st_aspect_num = w / d; + st->st_aspect_den = h / d; + } } else { st->st_aspect_num = 0;