From ae9edd14916a9923d0a418b8eec6b246858758c3 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 8 Apr 2018 21:10:04 -0500 Subject: [PATCH] Fix shifting bits out of byte in tr_font.c Found using LLVM sanitizer. Reported by Dominic "lonkamikaze" Fandrey. --- code/renderercommon/tr_font.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/renderercommon/tr_font.c b/code/renderercommon/tr_font.c index 0f89d5ad..2687bee5 100644 --- a/code/renderercommon/tr_font.c +++ b/code/renderercommon/tr_font.c @@ -303,7 +303,7 @@ static int fdOffset; static byte *fdFile; int readInt( void ) { - int i = fdFile[fdOffset]+(fdFile[fdOffset+1]<<8)+(fdFile[fdOffset+2]<<16)+(fdFile[fdOffset+3]<<24); + int i = ((unsigned int)fdFile[fdOffset] | ((unsigned int)fdFile[fdOffset+1]<<8) | ((unsigned int)fdFile[fdOffset+2]<<16) | ((unsigned int)fdFile[fdOffset+3]<<24)); fdOffset += 4; return i; }