[FFmpeg-cvslog] avcodec/jpeg2000dec: prevent out of array accesses in pixel addressing
Michael Niedermayer
git at videolan.org
Tue Dec 24 04:00:53 CET 2013
ffmpeg | branch: release/2.0 | Michael Niedermayer <michaelni at gmx.at> | Sun Oct 13 21:18:23 2013 +0200| [93f26b79926cf311784ce939ba570cf282e15b5c] | committer: Michael Niedermayer
avcodec/jpeg2000dec: prevent out of array accesses in pixel addressing
Fixes Ticket2921
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit fe448cd28d674c3eff3072552eae366d0b659ce9)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=93f26b79926cf311784ce939ba570cf282e15b5c
---
libavcodec/jpeg2000dec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 4fe9136..3856d7b 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1273,12 +1273,12 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
y = tile->comp[compno].coord[1][0] - s->image_offset_y;
- line = picture->data[plane] + y * picture->linesize[plane];
+ line = picture->data[plane] + y / s->cdy[compno] * picture->linesize[plane];
for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {
uint8_t *dst;
x = tile->comp[compno].coord[0][0] - s->image_offset_x;
- dst = line + x * pixelsize + compno*!planar;
+ dst = line + x / s->cdx[compno] * pixelsize + compno*!planar;
if (codsty->transform == FF_DWT97) {
for (; x < w; x += s->cdx[compno]) {
@@ -1319,12 +1319,12 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);
y = tile->comp[compno].coord[1][0] - s->image_offset_y;
- linel = (uint16_t *)picture->data[plane] + y * (picture->linesize[plane] >> 1);
+ linel = (uint16_t *)picture->data[plane] + y / s->cdy[compno] * (picture->linesize[plane] >> 1);
for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {
uint16_t *dst;
x = tile->comp[compno].coord[0][0] - s->image_offset_x;
- dst = linel + (x * pixelsize + compno*!planar);
+ dst = linel + (x / s->cdx[compno] * pixelsize + compno*!planar);
if (codsty->transform == FF_DWT97) {
for (; x < w; x += s-> cdx[compno]) {
int val = lrintf(*datap) + (1 << (cbps - 1));
More information about the ffmpeg-cvslog
mailing list