# HG changeset patch # User reimar # Date 1235815612 0 # Node ID 5f24919c13efde08ceb59a98f03d974c2068dd50 # Parent 267dd38c800e1b25b21b12a3a2fadd26fe8218cf Fix a possible NULL-pointer crash introduced by local changes to libfaad2 diff -r 267dd38c800e -r 5f24919c13ef libfaad2/local_changes.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 */ diff -r 267dd38c800e -r 5f24919c13ef libfaad2/specrec.c --- 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)