[vlc-commits] core: update_crypto: Ensure we don't overflow while shifting

Hugo Beauzée-Luyssen git at videolan.org
Tue Apr 27 11:46:50 UTC 2021


vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Apr 19 11:49:27 2021 +0200| [4cd66139cef61e9a7390db304e99ee80f01bf555] | committer: Hugo Beauzée-Luyssen

core: update_crypto: Ensure we don't overflow while shifting

(cherry picked from commit 984407ba32a0f3d4ed5dd69510b943003bb3bd63)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=4cd66139cef61e9a7390db304e99ee80f01bf555
---

 src/misc/update_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/misc/update_crypto.c b/src/misc/update_crypto.c
index d4e65fa2a6..09479468c0 100644
--- a/src/misc/update_crypto.c
+++ b/src/misc/update_crypto.c
@@ -63,7 +63,7 @@ static inline uint32_t scalar_number( const uint8_t *p, int header_len )
     else if( header_len == 2 )
         return( (p[0] << 8) + p[1] );
     else if( header_len == 4 )
-        return( (p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3] );
+        return( ((uint32_t)p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3] );
     else
         abort();
 }



More information about the vlc-commits mailing list