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

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| [da317efd92561290952a8aa191f1e5ea498a27c4] | committer: Michael Niedermayer

j2k: reorder multiplications to avoid interger overflows related to precincts

Fixes CID703778, CID703777
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/j2k.c b/libavcodec/j2k.c
index 196d7fd..f5b40b1 100644
--- a/libavcodec/j2k.c
+++ b/libavcodec/j2k.c
@@ -288,7 +288,7 @@ int ff_j2k_init_component(J2kComponent *comp, J2kCodingStyle *codsty, J2kQuantSt
             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));
+            band->prec = av_malloc(sizeof(J2kCblk) * reslevel->num_precincts_x * reslevel->num_precincts_y);
             if (!band->prec)
                 return AVERROR(ENOMEM);
 



More information about the ffmpeg-cvslog mailing list