[FFmpeg-cvslog] j2k: reorder multiplications to avoid interger overflows related to code blocks

Michael Niedermayer git at videolan.org
Tue Oct 23 00:07:52 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Oct 22 23:56:14 2012 +0200| [45ae9a8fc903d5b5041a5d34015aa98ab2bc12be] | committer: Michael Niedermayer

j2k: reorder multiplications to avoid interger overflows related to code blocks

Fixes CID703776, CID703775
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/j2k.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/j2k.c b/libavcodec/j2k.c
index 606a3d8..196d7fd 100644
--- a/libavcodec/j2k.c
+++ b/libavcodec/j2k.c
@@ -285,7 +285,7 @@ int ff_j2k_init_component(J2kComponent *comp, J2kCodingStyle *codsty, J2kQuantSt
             band->cblknx = ff_j2k_ceildiv(band->cblknx, dx);
             band->cblkny = ff_j2k_ceildiv(band->cblkny, dy);
 
-            band->cblk = av_malloc(band->cblknx * band->cblkny * sizeof(J2kCblk));
+            band->cblk = av_malloc(sizeof(J2kCblk) * band->cblknx * band->cblkny);
             if (!band->cblk)
                 return AVERROR(ENOMEM);
             band->prec = av_malloc(reslevel->num_precincts_x * reslevel->num_precincts_y * sizeof(J2kPrec));



More information about the ffmpeg-cvslog mailing list