From ffd5fdd81b218fd10f4a4f9d3d8e1691109444bb Mon Sep 17 00:00:00 2001 From: Seoyeon Kim Date: Fri, 7 Feb 2020 16:19:51 +0900 Subject: [PATCH] Fix SVACE issue - Integer overflow may occur due to arithmetic operation. : fileHeader.zsize is unsigned char[], and zDepth is unsigned int Change-Id: I9fbd76a1e8f52933a50ae4b014ec361db3a6babf Signed-off-by: Seoyeon Kim --- dali/internal/imaging/common/loader-astc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dali/internal/imaging/common/loader-astc.cpp b/dali/internal/imaging/common/loader-astc.cpp index 4765bf9..1371a65 100755 --- a/dali/internal/imaging/common/loader-astc.cpp +++ b/dali/internal/imaging/common/loader-astc.cpp @@ -138,7 +138,9 @@ bool LoadAstcHeader( FILE * const filePointer, unsigned int& width, unsigned int width = fileHeader.xsize[0] | ( fileHeader.xsize[1] << 8 ) | ( fileHeader.xsize[2] << 16 ); height = fileHeader.ysize[0] | ( fileHeader.ysize[1] << 8 ) | ( fileHeader.ysize[2] << 16 ); - const unsigned int zDepth = fileHeader.zsize[0] + ( fileHeader.zsize[1] << 8 ) + ( fileHeader.zsize[2] << 16 ); + const unsigned int zDepth = static_cast( fileHeader.zsize[0] ) + + ( static_cast( fileHeader.zsize[1] ) << 8 ) + + ( static_cast( fileHeader.zsize[2] ) << 16 ); // Check image dimensions are within limits. if( ( width > MAX_TEXTURE_DIMENSION ) || ( height > MAX_TEXTURE_DIMENSION ) ) -- 2.7.4