diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2015-08-09 08:50:30 +1000 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2015-08-09 08:50:35 +1000 |
commit | 7083cf2d9041f51c53441c7246664b34dce65a64 (patch) | |
tree | 302657ab48ce5800b1731101f79d172481c531d8 /src/libFLAC/stream_decoder.c | |
parent | 4f84da5dd4b07fe1964a5a25af58ce94f9e890b4 (diff) | |
download | flac-7083cf2d9041f51c53441c7246664b34dce65a64.tar.gz |
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>
Diffstat (limited to 'src/libFLAC/stream_decoder.c')
-rw-r--r-- | src/libFLAC/stream_decoder.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index 04ce7cdc..519b0c32 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -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 */ |