fix NULL ptr arithmetic at lz4:2299

This commit is contained in:
Yann Collet 2021-05-28 01:10:41 -07:00
parent 539c783c98
commit dfc431fb3d

View File

@ -2298,8 +2298,13 @@ int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream)
int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize)
{
LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse;
lz4sd->prefixSize = (size_t) dictSize;
lz4sd->prefixEnd = (const BYTE*) dictionary + dictSize;
lz4sd->prefixSize = (size_t)dictSize;
if (dictSize) {
assert(dictionary != NULL);
lz4sd->prefixEnd = (const BYTE*) dictionary + dictSize;
} else {
lz4sd->prefixEnd = (const BYTE*) dictionary;
}
lz4sd->externalDict = NULL;
lz4sd->extDictSize = 0;
return 1;