diff --git a/tests/Makefile b/tests/Makefile index cb77b0160..088a098a6 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -183,6 +183,10 @@ zstreamtest_tsan : CFLAGS += -fsanitize=thread zstreamtest_tsan : $(ZSTREAMFILES) $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT) +zstreamtest_ubsan : CFLAGS += -fsanitize=undefined +zstreamtest_ubsan : $(ZSTREAMFILES) + $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT) + # note : broken : requires symbols unavailable from dynamic library zstreamtest-dll : $(ZSTDDIR)/common/xxhash.c # xxh symbols not exposed from dll zstreamtest-dll : $(ZSTREAM_LOCAL_FILES) diff --git a/tests/zstreamtest.c b/tests/zstreamtest.c index 3fcdd5399..d4c9823e2 100644 --- a/tests/zstreamtest.c +++ b/tests/zstreamtest.c @@ -548,6 +548,15 @@ static int basicUnitTests(U32 seed, double compressibility) { size_t const ret = ZSTD_decompressStream(zd, &outBuff, &inBuff); if (ret != 0) goto _output_error; } + inBuff.src = NULL; + inBuff.size = 0; + inBuff.pos = 0; + outBuff.dst = NULL; + outBuff.size = 0; + outBuff.pos = 0; + CHECK_Z( ZSTD_initDStream(zd) ); + CHECK_Z(ZSTD_decompressStream(zd, &outBuff, &inBuff)); + DISPLAYLEVEL(3, "OK\n"); /* _srcSize compression test */ DISPLAYLEVEL(3, "test%3i : compress_srcSize %u bytes : ", testNb++, COMPRESSIBLE_NOISE_LENGTH); diff --git a/tests/zstreamtest_ubsan b/tests/zstreamtest_ubsan new file mode 100755 index 000000000..55a36fdab Binary files /dev/null and b/tests/zstreamtest_ubsan differ