]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Avoid division by zero if h264 width and/or height is 0. (Happens on corrupt data)
authorAndreas Öman <andreas@lonelycoder.com>
Sun, 7 Nov 2010 22:43:24 +0000 (22:43 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Sun, 7 Nov 2010 22:43:24 +0000 (22:43 +0000)
src/parser_h264.c

index 383304900437be87d0af698fbd7e4f71a4eccafb..7f31f2362ff4c91c3a1e2153137c3b053fb4dffc 100644 (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;