Skip to content

zstd 1.5.4 compression error less than or equal to 4 bytes src by the ZSTD_compress function #3524

@Pavel12398

Description

@Pavel12398

if compressing less than or equal to 4 bytes the function will return exceptions

version zstd 1.5.4
Windows 10 Pro 21H2 19044.2604
CPU: i7-6700K
Compiler: Visual Studio 2022 (v143)
here is a sample code

int main() {
   
	const size_t srcSize = 4;
	char src[srcSize] = {0x0 ,0x0 ,0x0 ,0x0 };
	

	size_t dstSize = srcSize + 12 + max(1, (srcSize + 12) / 1000);
	char* dst = new char[dstSize];
	
	size_t const countSize = ZSTD_compress((void*)dst, dstSize, (const void*)src, srcSize, 3);
	if (ZSTD_isError(countSize)) {
		assert(!ZSTD_isError(countSize));
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions