summaryrefslogtreecommitdiff
path: root/libavcodec/alac.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-04-24 00:01:43 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-05-08 11:10:51 +0200
commit243e8443cd9e83c887e3f5edf09a169e7783d14e (patch)
treef45f797c979ed3f0acf72b946afb8b36207d5e16 /libavcodec/alac.c
parent295e05a762332c5edcc84c325e94457815a51b5c (diff)
alac: Reject rice_limit 0 if compression is used
If in compression mode rice_limit = 0 leads to call `show_bits(gb, k)` in `decode_scalar` with k = 0. Request a sample in case it is valid and it should be accepted. Signed-off-by: Luca Barbato <lu_zero@gentoo.org> CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/alac.c')
-rw-r--r--libavcodec/alac.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 48903a671b..9579e18185 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -307,6 +307,12 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
int lpc_quant[2];
int rice_history_mult[2];
+ if (!alac->rice_limit) {
+ avpriv_request_sample(alac->avctx,
+ "Compression with rice limit 0");
+ return AVERROR(ENOSYS);
+ }
+
decorr_shift = get_bits(&alac->gb, 8);
decorr_left_weight = get_bits(&alac->gb, 8);