tier1: fix possible unsafe read in lzss SafeUncompress, make tests pass under asan

This commit is contained in:
nillerusr
2023-04-07 14:59:36 +03:00
parent 4f063c4053
commit 92028d4e80
7 changed files with 115 additions and 25 deletions
+10
View File
@@ -606,6 +606,16 @@ typedef void * HINSTANCE;
#define FMTFUNCTION( a, b )
#endif
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#define USING_ASAN 1
#endif
#endif
#if !defined( USING_ASAN ) && defined( __SANITIZE_ADDRESS__ )
#define USING_ASAN 1
#endif
#if COMPILER_CLANG || COMPILER_GCC
#define NO_ASAN __attribute__((no_sanitize("address")))
#else
+1 -1
View File
@@ -30,7 +30,7 @@ public:
unsigned char* CompressNoAlloc( const unsigned char *pInput, int inputlen, unsigned char *pOutput, unsigned int *pOutputSize );
unsigned int Uncompress( const unsigned char *pInput, unsigned char *pOutput );
//unsigned int Uncompress( unsigned char *pInput, CUtlBuffer &buf );
unsigned int SafeUncompress( const unsigned char *pInput, unsigned char *pOutput, unsigned int unBufSize );
unsigned int SafeUncompress( const unsigned char *pInput, unsigned int inputSize, unsigned char *pOutput, unsigned int unBufSize );
static bool IsCompressed( const unsigned char *pInput );
static unsigned int GetActualSize( const unsigned char *pInput );