[FFmpeg-cvslog] avcodec/jpeg2000dec: Clip all tile coordinates

2015-12-06 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | 
Sat Nov  7 02:16:11 2015 +0100| [d73a8ae70f15d4c9145c20db709f4b06b0a8e835] | 
committer: Michael Niedermayer

avcodec/jpeg2000dec: Clip all tile coordinates

Fixes out of array access
Fixes: 
b877a6b788a25c70e8b1d014f8628549/asan_heap-oob_1da2c3f_2324_5a1b329b0b3c4bb6b1d775660ac56717.r3d

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 43492ff3ab68a343c1264801baa1d5a02de10167)

Conflicts:

libavcodec/jpeg2000dec.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d73a8ae70f15d4c9145c20db709f4b06b0a8e835
---

 libavcodec/jpeg2000dec.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 30e069e..eac3661 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -684,10 +684,10 @@ static int init_tile(Jpeg2000DecoderContext *s, int 
tileno)
 Jpeg2000QuantStyle  *qntsty = tile->qntsty + compno;
 int ret; // global bandno
 
-comp->coord_o[0][0] = FFMAX(tilex   * s->tile_width  + 
s->tile_offset_x, s->image_offset_x);
-comp->coord_o[0][1] = FFMIN((tilex + 1) * s->tile_width  + 
s->tile_offset_x, s->width);
-comp->coord_o[1][0] = FFMAX(tiley   * s->tile_height + 
s->tile_offset_y, s->image_offset_y);
-comp->coord_o[1][1] = FFMIN((tiley + 1) * s->tile_height + 
s->tile_offset_y, s->height);
+comp->coord_o[0][0] = av_clip(tilex   * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+comp->coord_o[0][1] = av_clip((tilex + 1) * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+comp->coord_o[1][0] = av_clip(tiley   * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
+comp->coord_o[1][1] = av_clip((tiley + 1) * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
 
 comp->coord[0][0] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], 
s->reduction_factor);
 comp->coord[0][1] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][1], 
s->reduction_factor);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/jpeg2000dec: Clip all tile coordinates

2015-11-26 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer  | 
Sat Nov  7 02:16:11 2015 +0100| [9e755b9b99c3c28a27a34d276a182b84f8563eff] | 
committer: Michael Niedermayer

avcodec/jpeg2000dec: Clip all tile coordinates

Fixes out of array access
Fixes: 
b877a6b788a25c70e8b1d014f8628549/asan_heap-oob_1da2c3f_2324_5a1b329b0b3c4bb6b1d775660ac56717.r3d

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 43492ff3ab68a343c1264801baa1d5a02de10167)

Conflicts:

libavcodec/jpeg2000dec.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e755b9b99c3c28a27a34d276a182b84f8563eff
---

 libavcodec/jpeg2000dec.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 4f5b32f..7063e42 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -686,10 +686,10 @@ static int init_tile(Jpeg2000DecoderContext *s, int 
tileno)
 Jpeg2000QuantStyle  *qntsty = tile->qntsty + compno;
 int ret; // global bandno
 
-comp->coord_o[0][0] = FFMAX(tilex   * s->tile_width  + 
s->tile_offset_x, s->image_offset_x);
-comp->coord_o[0][1] = FFMIN((tilex + 1) * s->tile_width  + 
s->tile_offset_x, s->width);
-comp->coord_o[1][0] = FFMAX(tiley   * s->tile_height + 
s->tile_offset_y, s->image_offset_y);
-comp->coord_o[1][1] = FFMIN((tiley + 1) * s->tile_height + 
s->tile_offset_y, s->height);
+comp->coord_o[0][0] = av_clip(tilex   * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+comp->coord_o[0][1] = av_clip((tilex + 1) * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+comp->coord_o[1][0] = av_clip(tiley   * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
+comp->coord_o[1][1] = av_clip((tiley + 1) * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
 
 comp->coord[0][0] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], 
s->reduction_factor);
 comp->coord[0][1] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][1], 
s->reduction_factor);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/jpeg2000dec: Clip all tile coordinates

2015-11-19 Thread Michael Niedermayer
ffmpeg | branch: release/2.6 | Michael Niedermayer  | 
Sat Nov  7 02:16:11 2015 +0100| [9f6e755272e7d07e83a5b8224be7eb3318204916] | 
committer: Michael Niedermayer

avcodec/jpeg2000dec: Clip all tile coordinates

Fixes out of array access
Fixes: 
b877a6b788a25c70e8b1d014f8628549/asan_heap-oob_1da2c3f_2324_5a1b329b0b3c4bb6b1d775660ac56717.r3d

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 43492ff3ab68a343c1264801baa1d5a02de10167)

Conflicts:

libavcodec/jpeg2000dec.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f6e755272e7d07e83a5b8224be7eb3318204916
---

 libavcodec/jpeg2000dec.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index f4b2d72..5321fff 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -686,10 +686,10 @@ static int init_tile(Jpeg2000DecoderContext *s, int 
tileno)
 Jpeg2000QuantStyle  *qntsty = tile->qntsty + compno;
 int ret; // global bandno
 
-comp->coord_o[0][0] = FFMAX(tilex   * s->tile_width  + 
s->tile_offset_x, s->image_offset_x);
-comp->coord_o[0][1] = FFMIN((tilex + 1) * s->tile_width  + 
s->tile_offset_x, s->width);
-comp->coord_o[1][0] = FFMAX(tiley   * s->tile_height + 
s->tile_offset_y, s->image_offset_y);
-comp->coord_o[1][1] = FFMIN((tiley + 1) * s->tile_height + 
s->tile_offset_y, s->height);
+comp->coord_o[0][0] = av_clip(tilex   * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+comp->coord_o[0][1] = av_clip((tilex + 1) * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+comp->coord_o[1][0] = av_clip(tiley   * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
+comp->coord_o[1][1] = av_clip((tiley + 1) * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
 
 comp->coord[0][0] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], 
s->reduction_factor);
 comp->coord[0][1] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][1], 
s->reduction_factor);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/jpeg2000dec: Clip all tile coordinates

2015-11-11 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Sat Nov  7 02:16:11 2015 +0100| [169a02da1e39915f20f21d67de5747e1752d8da2] | 
committer: Michael Niedermayer

avcodec/jpeg2000dec: Clip all tile coordinates

Fixes out of array access
Fixes: 
b877a6b788a25c70e8b1d014f8628549/asan_heap-oob_1da2c3f_2324_5a1b329b0b3c4bb6b1d775660ac56717.r3d

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 43492ff3ab68a343c1264801baa1d5a02de10167)

Conflicts:

libavcodec/jpeg2000dec.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=169a02da1e39915f20f21d67de5747e1752d8da2
---

 libavcodec/jpeg2000dec.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 24cb8a1..444a731 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -705,10 +705,10 @@ static int init_tile(Jpeg2000DecoderContext *s, int 
tileno)
 Jpeg2000QuantStyle  *qntsty = tile->qntsty + compno;
 int ret; // global bandno
 
-comp->coord_o[0][0] = FFMAX(tilex   * s->tile_width  + 
s->tile_offset_x, s->image_offset_x);
-comp->coord_o[0][1] = FFMIN((tilex + 1) * s->tile_width  + 
s->tile_offset_x, s->width);
-comp->coord_o[1][0] = FFMAX(tiley   * s->tile_height + 
s->tile_offset_y, s->image_offset_y);
-comp->coord_o[1][1] = FFMIN((tiley + 1) * s->tile_height + 
s->tile_offset_y, s->height);
+comp->coord_o[0][0] = av_clip(tilex   * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+comp->coord_o[0][1] = av_clip((tilex + 1) * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+comp->coord_o[1][0] = av_clip(tiley   * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
+comp->coord_o[1][1] = av_clip((tiley + 1) * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
 if (compno) {
 comp->coord_o[0][0] /= s->cdx[compno];
 comp->coord_o[0][1] /= s->cdx[compno];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/jpeg2000dec: Clip all tile coordinates

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Sat Nov  7 02:16:11 2015 +0100| [56419053bcaef67acb41dbc1934aa8eaec9acbe6] | 
committer: Michael Niedermayer

avcodec/jpeg2000dec: Clip all tile coordinates

Fixes out of array access
Fixes: 
b877a6b788a25c70e8b1d014f8628549/asan_heap-oob_1da2c3f_2324_5a1b329b0b3c4bb6b1d775660ac56717.r3d

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 43492ff3ab68a343c1264801baa1d5a02de10167)

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=56419053bcaef67acb41dbc1934aa8eaec9acbe6
---

 libavcodec/jpeg2000dec.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index e0747b0..88a1677 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -826,10 +826,10 @@ static int init_tile(Jpeg2000DecoderContext *s, int 
tileno)
 if (!tile->comp)
 return AVERROR(ENOMEM);
 
-tile->coord[0][0] = FFMAX(tilex   * s->tile_width  + s->tile_offset_x, 
s->image_offset_x);
-tile->coord[0][1] = FFMIN((tilex + 1) * s->tile_width  + s->tile_offset_x, 
s->width);
-tile->coord[1][0] = FFMAX(tiley   * s->tile_height + s->tile_offset_y, 
s->image_offset_y);
-tile->coord[1][1] = FFMIN((tiley + 1) * s->tile_height + s->tile_offset_y, 
s->height);
+tile->coord[0][0] = av_clip(tilex   * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+tile->coord[0][1] = av_clip((tilex + 1) * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+tile->coord[1][0] = av_clip(tiley   * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
+tile->coord[1][1] = av_clip((tiley + 1) * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
 
 for (compno = 0; compno < s->ncomponents; compno++) {
 Jpeg2000Component *comp = tile->comp + compno;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/jpeg2000dec: Clip all tile coordinates

2015-11-06 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Nov  7 02:16:11 2015 +0100| [43492ff3ab68a343c1264801baa1d5a02de10167] | 
committer: Michael Niedermayer

avcodec/jpeg2000dec: Clip all tile coordinates

Fixes out of array access
Fixes: 
b877a6b788a25c70e8b1d014f8628549/asan_heap-oob_1da2c3f_2324_5a1b329b0b3c4bb6b1d775660ac56717.r3d

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=43492ff3ab68a343c1264801baa1d5a02de10167
---

 libavcodec/jpeg2000dec.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index c8b0dab..31f3db8 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -826,10 +826,10 @@ static int init_tile(Jpeg2000DecoderContext *s, int 
tileno)
 if (!tile->comp)
 return AVERROR(ENOMEM);
 
-tile->coord[0][0] = FFMAX(tilex   * s->tile_width  + s->tile_offset_x, 
s->image_offset_x);
-tile->coord[0][1] = FFMIN((tilex + 1) * s->tile_width  + s->tile_offset_x, 
s->width);
-tile->coord[1][0] = FFMAX(tiley   * s->tile_height + s->tile_offset_y, 
s->image_offset_y);
-tile->coord[1][1] = FFMIN((tiley + 1) * s->tile_height + s->tile_offset_y, 
s->height);
+tile->coord[0][0] = av_clip(tilex   * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+tile->coord[0][1] = av_clip((tilex + 1) * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+tile->coord[1][0] = av_clip(tiley   * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
+tile->coord[1][1] = av_clip((tiley + 1) * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
 
 for (compno = 0; compno < s->ncomponents; compno++) {
 Jpeg2000Component *comp = tile->comp + compno;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog