mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-20 06:20:40 +00:00
jpeg2000dec: make cblk->length(inc)/data use consistent
Fixes Ticket2612 Reviewed-by: Nicolas BERTRAND <nicoinattendu@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
de12b454f2
commit
582f53349e
@ -671,17 +671,11 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s,
|
||||
for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {
|
||||
Jpeg2000Cblk *cblk = prec->cblk + cblkno;
|
||||
if ( bytestream2_get_bytes_left(&s->g) < cblk->lengthinc
|
||||
|| sizeof(cblk->data) < cblk->lengthinc
|
||||
|| sizeof(cblk->data) < cblk->length + cblk->lengthinc + 2
|
||||
)
|
||||
return AVERROR(EINVAL);
|
||||
/* Code-block data can be empty. In that case initialize data
|
||||
* with 0xFFFF. */
|
||||
if (cblk->lengthinc > 0) {
|
||||
bytestream2_get_bufferu(&s->g, cblk->data, cblk->lengthinc);
|
||||
} else {
|
||||
cblk->data[0] = 0xFF;
|
||||
cblk->data[1] = 0xFF;
|
||||
}
|
||||
|
||||
bytestream2_get_bufferu(&s->g, cblk->data + cblk->length, cblk->lengthinc);
|
||||
cblk->length += cblk->lengthinc;
|
||||
cblk->lengthinc = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user