Fix a possible NULL-pointer crash introduced by local changes to libfaad2
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sat, 28 Feb 2009 10:06:52 +0000 (10:06 +0000)
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sat, 28 Feb 2009 10:06:52 +0000 (10:06 +0000)
git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@28757 b3059339-0415-0410-9bf9-f77b7e298cf2

libfaad2/local_changes.diff
libfaad2/specrec.c

index 0e3fe95..db2b60c 100644 (file)
      }
  #endif
  
-@@ -865,22 +842,13 @@
+@@ -865,22 +842,14 @@
  
      /* always allocate 2 channels, PS can always "suddenly" turn up */
  #if (defined(PS_DEC) || defined(DRM_PS))
 -    if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
 -    {
 -        /* element_output_channels not set yet */
-+    if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] < output_channels) {
++    if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0 ||
++        hDecoder->element_output_channels[hDecoder->fr_ch_ele] < output_channels) {
          hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
 -    } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) {
 -        /* element inconsistency */
index 1119dd3..d4d6009 100644 (file)
@@ -847,7 +847,8 @@ uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics,
     output_channels = 1;
 #endif
 
-    if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] < output_channels) {
+    if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0 ||
+        hDecoder->element_output_channels[hDecoder->fr_ch_ele] < output_channels) {
         hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
         retval = allocate_single_channel(hDecoder, sce->channel, output_channels);
         if (retval > 0)