mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-31 11:53:24 +00:00
j2kdec: Fix crash in get_qcx
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 282bb02839
)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
6b4c38b362
commit
4ad5618210
@ -359,7 +359,7 @@ static int get_qcx(J2kDecoderContext *s, int n, J2kQuantStyle *q)
|
||||
|
||||
if (q->quantsty == J2K_QSTY_NONE){
|
||||
n -= 3;
|
||||
if (s->buf_end - s->buf < n)
|
||||
if (s->buf_end - s->buf < n || 32*3 < n)
|
||||
return AVERROR(EINVAL);
|
||||
for (i = 0; i < n; i++)
|
||||
q->expn[i] = bytestream_get_byte(&s->buf) >> 3;
|
||||
@ -376,7 +376,7 @@ static int get_qcx(J2kDecoderContext *s, int n, J2kQuantStyle *q)
|
||||
}
|
||||
} else{
|
||||
n = (n - 3) >> 1;
|
||||
if (s->buf_end - s->buf < n)
|
||||
if (s->buf_end - s->buf < n || 32*3 < n)
|
||||
return AVERROR(EINVAL);
|
||||
for (i = 0; i < n; i++){
|
||||
x = bytestream_get_be16(&s->buf);
|
||||
|
Loading…
Reference in New Issue
Block a user