[vlc-commits] jpeg2000: avoid arithmetic overflow (CID #1415689)

Tristan Matthews git at videolan.org
Wed Jul 26 06:39:47 CEST 2017


vlc | branch: master | Tristan Matthews <tmatth at videolan.org> | Wed Jul 26 00:30:14 2017 -0400| [3fdb5dc83f1744ba346b481a398507d9ee0af8d8] | committer: Tristan Matthews

jpeg2000: avoid arithmetic overflow (CID #1415689)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3fdb5dc83f1744ba346b481a398507d9ee0af8d8
---

 modules/codec/jpeg2000.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/codec/jpeg2000.h b/modules/codec/jpeg2000.h
index e2615c4935..c1a528038a 100644
--- a/modules/codec/jpeg2000.h
+++ b/modules/codec/jpeg2000.h
@@ -56,7 +56,7 @@ static inline bool j2k_is_valid_framerate( unsigned num, unsigned den )
 static inline enum j2k_profiles_e j2k_get_profile( unsigned w, unsigned h,
                                                    unsigned num, unsigned den, bool p )
 {
-    const uint64_t s = w * h;
+    const uint64_t s = w *(uint64_t)h;
     const uint64_t f = num / den;
     if( s <= 720*576 && f < 50 )
         return J2K_PROFILE_SD; /* VSF_TR-01_2013-04-15 */



More information about the vlc-commits mailing list