Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/escape124.c')
-rw-r--r--libavcodec/escape124.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index eb051eba54..14f9396332 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -221,7 +221,11 @@ static int escape124_decode_frame(AVCodecContext *avctx,
// This call also guards the potential depth reads for the
// codebook unpacking.
- if (get_bits_left(&gb) < 64)
+ // Check if the amount we will read minimally is available on input.
+ // The 64 represent the immedeatly next 2 frame_* elements read, the 23/4320
+ // represent a lower bound of the space needed for skiped superblocks. Non
+ // skipped SBs need more space.
+ if (get_bits_left(&gb) < 64 + s->num_superblocks * 23LL / 4320)
return -1;
frame_flags = get_bits_long(&gb, 32);