decoder: Treat negative qlp_shift as an error

Shift by a negative value is undefined behaviour so there is no "right"
way of dealing with this.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
This commit is contained in:
Erik de Castro Lopo 2015-08-09 08:50:30 +10:00
parent 4f84da5dd4
commit 7083cf2d90

View File

@ -2665,6 +2665,11 @@ FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, un
/* read qlp shift */
if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN))
return false; /* read_callback_ sets the state for us */
if(i32 < 0) {
send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
return true;
}
subframe->quantization_level = i32;
/* read quantized lp coefficiencts */