aacparse: fix uninitialized variables in LOAS config reading
authorGuillaume Marquebielle <guillaume.marquebielle@parrot.com>
Fri, 25 Sep 2015 08:01:37 +0000 (10:01 +0200)
committerJan Schmidt <jan@centricular.com>
Sat, 26 Sep 2015 12:18:26 +0000 (22:18 +1000)
On reading LOAS config, flag v=1 and vA=1 combination can occur, leading to warning
"Spec says "TBD"...". Returning TRUE on this case while parameters 'sample_rate' and
'channels' are pointing to uninitialized values can end on setting random values as
rate and channels on src caps.

https://bugzilla.gnome.org/show_bug.cgi?id=755611

gst/audioparsers/gstaacparse.c

index b1afc81..cd75b7f 100644 (file)
@@ -655,6 +655,7 @@ gst_aac_parse_read_loas_config (GstAacParse * aacparse, const guint8 * data,
     GST_LOG_OBJECT (aacparse, "More data ignored");
   } else {
     GST_WARNING_OBJECT (aacparse, "Spec says \"TBD\"...");
+    return FALSE;
   }
   return TRUE;
 }
@@ -870,7 +871,7 @@ gst_aac_parse_detect_stream (GstAacParse * aacparse,
 
   if (gst_aac_parse_check_loas_frame (aacparse, data, avail, drain,
           framesize, &need_data_loas)) {
-    gint rate, channels;
+    gint rate = 0, channels = 0;
 
     GST_INFO ("LOAS, framesize: %d", *framesize);
 
@@ -1212,7 +1213,7 @@ gst_aac_parse_handle_frame (GstBaseParse * parse,
   gboolean lost_sync;
   GstBuffer *buffer;
   guint framesize;
-  gint rate, channels;
+  gint rate = 0, channels = 0;
 
   aacparse = GST_AAC_PARSE (parse);
   buffer = frame->buffer;