[FFmpeg-cvslog] jpeg2000dec: make cblk->length(inc)/data use consistent
Michael Niedermayer
git at videolan.org
Mon Jun 17 20:15:30 CEST 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Jun 13 03:17:19 2013 +0200| [582f53349eabd75164d4389503eb95048982cfdc] | committer: Michael Niedermayer
jpeg2000dec: make cblk->length(inc)/data use consistent
Fixes Ticket2612
Reviewed-by: Nicolas BERTRAND <nicoinattendu at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=582f53349eabd75164d4389503eb95048982cfdc
---
libavcodec/jpeg2000dec.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 9da6610..caa5ae4 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -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;
}
More information about the ffmpeg-cvslog
mailing list