Re: [PATCH RFC 1/9] lib/lz4: import upstream LZ4 sources verbatim

From: Sergey Senozhatsky

Date: Mon Sep 28 2026 - 01:20:12 EST


On (26/09/25 13:27), Michal Wilczynski wrote:
[..]
> +int LZ4_compress_fast_extState(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration)
> +{
> + LZ4_stream_t_internal* const ctx = & LZ4_initStream(state, sizeof(LZ4_stream_t)) -> internal_donotuse;
> + assert(ctx != NULL);

Probably in some other places as well:

LZ4_initStream() can return NULL, but the code immediately derefs
the pointer. The assert() check seems to be misplaced, unless I'm
missing something.

I suppose those need to be decoupled. First LZ4_initStream() call and
NULL check, then stream->internal_donotuse.