Skip to content

Commit

Permalink
Do not shrink decoding buffer when parameters change
Browse files Browse the repository at this point in the history
As files with a changing number of channels or bit depth are rare
and difficult the handle anyway, improve fuzzer performance with
them by limiting realloction of the decoding buffer
  • Loading branch information
ktmf01 committed Dec 2, 2024
1 parent 7e0c04c commit c2c1a57
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libFLAC/stream_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1552,6 +1552,11 @@ FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, uint32_t size, uint32_
decoder->private_->side_subframe = 0;
}

/* Only grow per-channel buffers, even if number of channels increases */
if(decoder->private_->output_capacity > size) {
size = decoder->private_->output_capacity;
}

for(i = 0; i < channels; i++) {
/* WATCHOUT:
* FLAC__lpc_restore_signal_asm_ia32_mmx() and ..._intrin_sseN()
Expand Down

0 comments on commit c2c1a57

Please sign in to comment.