1
mirror of https://github.com/mpv-player/mpv synced 2024-10-30 04:46:41 +01:00

Fix a possible NULL-pointer crash introduced by local changes to libfaad2

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28757 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2009-02-28 10:06:52 +00:00
parent 3a81bf82a0
commit d1acb18902
2 changed files with 5 additions and 3 deletions

View File

@ -360,7 +360,7 @@
} }
#endif #endif
@@ -865,22 +842,13 @@ @@ -865,22 +842,14 @@
/* always allocate 2 channels, PS can always "suddenly" turn up */ /* always allocate 2 channels, PS can always "suddenly" turn up */
#if (defined(PS_DEC) || defined(DRM_PS)) #if (defined(PS_DEC) || defined(DRM_PS))
@ -373,7 +373,8 @@
- if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) - if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
- { - {
- /* element_output_channels not set yet */ - /* 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; hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
- } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) { - } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) {
- /* element inconsistency */ - /* element inconsistency */

View File

@ -847,7 +847,8 @@ uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics,
output_channels = 1; output_channels = 1;
#endif #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; hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
retval = allocate_single_channel(hDecoder, sce->channel, output_channels); retval = allocate_single_channel(hDecoder, sce->channel, output_channels);
if (retval > 0) if (retval > 0)