Skip to content

Commit e15ddb7

Browse files
umar0xmichaelni
authored andcommitted
avcodec/apac: reset bitstream_index unconditionally to avoid integer overflow
Found-by: Umar Pathan (Umar0x) Signed-off-by: Umar Pathan <[email protected]> Fixes: out of array access Fixes: signed integer overflow: 2147482624 + 1024 cannot be represented in type 'int' Fixes: hHqW0dFoQwHN
1 parent e33548a commit e15ddb7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎libavcodec/apac.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ static int apac_decode(AVCodecContext *avctx, AVFrame *frame,
143143
if ((int64_t)s->bitstream_size + buf_size > INT_MAX / (16 * 8))
144144
return AVERROR_INVALIDDATA;
145145

146-
if (s->bitstream_index > 0 && s->bitstream_size > 0) {
147-
memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
146+
if (s->bitstream_index > 0) {
147+
if (s->bitstream_size > 0)
148+
memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
148149
s->bitstream_index = 0;
149150
}
150151

0 commit comments

Comments
 (0)