h264: reset got_{sps,pps} when corrupted SPS/PPS headers are parsed.
authorZhao Halley <halley.zhao@intel.com>
Tue, 8 Jan 2013 21:40:46 +0000 (05:40 +0800)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 25 Jan 2013 10:23:24 +0000 (11:23 +0100)
Reset got_{sps,pps} when corrupted SPS/PPS headers are parsed. This means
that no frame will be decoded until valid SPS/PPS headers are parsed again.
This also prevents from parsing slice headers with invalid data, and avoids
potential crashes.

https://bugs.freedesktop.org/show_bug.cgi?id=57902

gst-libs/gst/vaapi/gstvaapidecoder_h264.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 3f8bb84..78b093d
@@ -1175,8 +1175,10 @@ decode_sps(GstVaapiDecoderH264 *decoder, GstH264NalUnit *nalu)
 
     memset(sps, 0, sizeof(*sps));
     result = gst_h264_parser_parse_sps(priv->parser, nalu, sps, TRUE);
-    if (result != GST_H264_PARSER_OK)
+    if (result != GST_H264_PARSER_OK) {
+        priv->got_sps = FALSE;
         return get_status(result);
+    }
 
     priv->got_sps = TRUE;
     return GST_VAAPI_DECODER_STATUS_SUCCESS;
@@ -1193,8 +1195,10 @@ decode_pps(GstVaapiDecoderH264 *decoder, GstH264NalUnit *nalu)
 
     memset(pps, 0, sizeof(*pps));
     result = gst_h264_parser_parse_pps(priv->parser, nalu, pps);
-    if (result != GST_H264_PARSER_OK)
+    if (result != GST_H264_PARSER_OK) {
+        priv->got_pps = FALSE;
         return get_status(result);
+    }
 
     priv->got_pps = TRUE;
     return GST_VAAPI_DECODER_STATUS_SUCCESS;