Skip to content

Commit

Permalink
Unbreak PS audio (#51)
Browse files Browse the repository at this point in the history
This reverts commit 3b80a57.
  • Loading branch information
fcartegnie authored May 4, 2020
1 parent ac7e621 commit 912b2ee
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions libfaad/specrec.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,18 +915,18 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics,
/* element_output_channels not set yet */
hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
} else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) {
/* element inconsistency
* this only happens if PS is actually found but not in the first frame
/* element inconsistency */

/* this only happens if PS is actually found but not in the first frame
* this means that there is only 1 bitstream element!
*/

if (hDecoder->fr_channels == 1) {
/* reset the allocation */
hDecoder->element_alloced[hDecoder->fr_ch_ele] = 0;
hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
} else {
return 21;
}
/* reset the allocation */
hDecoder->element_alloced[hDecoder->fr_ch_ele] = 0;

hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;

//return 21;
}

if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
Expand All @@ -938,6 +938,9 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics,
hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1;
}

/* sanity check, CVE-2018-20199, CVE-2018-20360 */
if(!hDecoder->time_out[sce->channel])
return 15;

/* dequantisation and scaling */
retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef, hDecoder->frameLength);
Expand Down Expand Up @@ -1118,6 +1121,10 @@ uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_s
hDecoder->element_alloced[hDecoder->fr_ch_ele] = 2;
}

/* sanity check, CVE-2018-20199, CVE-2018-20360 */
if(!hDecoder->time_out[cpe->channel])
return 15;

/* dequantisation and scaling */
retval = quant_to_spec(hDecoder, ics1, spec_data1, spec_coef1, hDecoder->frameLength);
if (retval > 0)
Expand Down

1 comment on commit 912b2ee

@fabiangreffrath
Copy link
Collaborator

@fabiangreffrath fabiangreffrath commented on 912b2ee Jun 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fcartegnie Do you think we could also revert commit
466b01d now that this fix is in place? @hlef

Please sign in to comment.