From fd4eb2e220834e6c3000952c0784ccb86d176286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Stadler?= Date: Tue, 1 Nov 2011 15:08:26 +0100 Subject: [PATCH] h264parser: fix access to uninitialized memory When vui->timing_info_present is 0, vui->fixed_frame_rate_flag and others cannot be accessed since they have not been set. It was also possible that sps->fps_{num,den} end up initialized here. --- gst-libs/gst/codecparsers/gsth264parser.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c index c50c7f36a0..87bff4eb66 100644 --- a/gst-libs/gst/codecparsers/gsth264parser.c +++ b/gst-libs/gst/codecparsers/gsth264parser.c @@ -1468,7 +1468,10 @@ gst_h264_parse_sps (GstH264NalUnit * nalu, GstH264SPS * sps, sps->width = width; sps->height = height; - if (vui) { + sps->fps_num = 0; + sps->fps_den = 1; + + if (vui && vui->timing_info_present_flag) { /* derive framerate */ /* FIXME verify / also handle other cases */ GST_LOG ("Framerate: %u %u %u %u", parse_vui_params, @@ -1484,8 +1487,6 @@ gst_h264_parse_sps (GstH264NalUnit * nalu, GstH264SPS * sps, GST_LOG ("framerate %d/%d", sps->fps_num, sps->fps_den); } } else { - sps->fps_num = 0; - sps->fps_den = 1; GST_LOG ("No VUI, unknown framerate"); }