changeset 28722:5f24919c13ef

Fix a possible NULL-pointer crash introduced by local changes to libfaad2
author reimar
date Sat, 28 Feb 2009 10:06:52 +0000
parents 267dd38c800e
children 68893c41ae26
files libfaad2/local_changes.diff libfaad2/specrec.c
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libfaad2/local_changes.diff	Sat Feb 28 08:01:52 2009 +0000
+++ b/libfaad2/local_changes.diff	Sat Feb 28 10:06:52 2009 +0000
@@ -360,7 +360,7 @@
      }
  #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))
@@ -373,7 +373,8 @@
 -    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 */
--- a/libfaad2/specrec.c	Sat Feb 28 08:01:52 2009 +0000
+++ b/libfaad2/specrec.c	Sat Feb 28 10:06:52 2009 +0000
@@ -847,7 +847,8 @@
     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)