summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/apedec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 4a69571ba4..907f45faff 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -421,9 +421,12 @@ static inline int ape_decode_value(APEContext *ctx, APERice *rice)
if (tmpk <= 16)
x = range_decode_bits(ctx, tmpk);
- else {
+ else if (tmpk <= 32) {
x = range_decode_bits(ctx, 16);
x |= (range_decode_bits(ctx, tmpk - 16) << 16);
+ } else {
+ av_log(ctx->avctx, AV_LOG_ERROR, "too many bits\n");
+ return -1;
}
x += overflow << tmpk;
} else {