changeset 10234:c2fc56bdee95 libavcodec

Check num_units_in_tick/time_scale to be valid and within the range we support. based on a patch by chrome
author michael
date Wed, 23 Sep 2009 09:58:44 +0000
parents f397ad0fa67d
children 14353a40db5e
files h264.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Wed Sep 23 09:03:26 2009 +0000
+++ b/h264.c	Wed Sep 23 09:58:44 2009 +0000
@@ -7087,6 +7087,10 @@
     if(sps->timing_info_present_flag){
         sps->num_units_in_tick = get_bits_long(&s->gb, 32);
         sps->time_scale = get_bits_long(&s->gb, 32);
+        if(sps->num_units_in_tick-1 > 0x7FFFFFFEU || sps->time_scale-1 > 0x7FFFFFFEU){
+            av_log(h->s.avctx, AV_LOG_ERROR, "time_scale/num_units_in_tick inavlid or unsupported (%d/%d)\n", sps->time_scale, sps->num_units_in_tick);
+            return -1;
+        }
         sps->fixed_frame_rate_flag = get_bits1(&s->gb);
     }