Avoid division by zero if h264 width and/or height is 0. (Happens on corrupt data)

This commit is contained in:
Andreas Öman 2010-11-07 22:43:24 +00:00
parent 46df6a2b72
commit 0cd90a8610

View file

@ -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;