envoyproxy / envoyproxy/envoy

UBSAN violation in ZlibCompressorImplTest.CallingChecksum

Open
#6,085 2 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 22h
Merged PRs (30d)
430

Description

Plumbing ASAN/UBSAN down to zlib in #6061 yields traces such as:

```
[ RUN ] ZlibCompressorImplTest.CallingChecksum
/build/tmp/_bazel_bazel/b570b5ccd0454dc9af9f65ab1833764d/execroot/envoy/external/com_github_madler_zlib/trees.c:873:42: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/string.h:43:28: note: nonnull attribute specified here
#0 0x1b71dd9 in _tr_stored_block /build/tmp/_bazel_bazel/b570b5ccd0454dc9af9f65ab1833764d/execroot/envoy/external/com_github_madler_zlib/trees.c:873:5
#1 0x1b4dc71 in deflate /build/tmp/_bazel_bazel/b570b5ccd0454dc9af9f65ab1833764d/execroot/envoy/external/com_github_madler_zlib/deflate.c:1025:17
#2 0x1b2deb1 in Envoy::Compressor::ZlibCompressorImpl::deflateNext(long) /proc/self/cwd/source/common/compressor/zlib_compressor_impl.cc:59:22
#3 0x1b2da8f in Envoy::Compressor::ZlibCompressorImpl::process(Envoy::Buffer::Instance&, long) /proc/self/cwd/source/common/compressor/zlib_compressor_impl.cc:78:10
#4 0x1b2d8d4 in Envoy::Compressor::ZlibCompressorImpl::compress(Envoy::Buffer::Instance&, Envoy::Compressor::State) /proc/self/cwd/source/common/compressor/zlib_compressor_impl.cc:55:3
#5 0x1a6faf0 in Envoy::Compressor::(anonymous namespace)::ZlibCompressorImplTester::compressThenFlush(Envoy::Buffer::OwnedImpl&) /proc/self/cwd/test/common/compressor/zlib_compressor_impl_test.cc:75:55
#6 0x1a7075b in Envoy::Compressor::(anonymous namespace)::ZlibCompressorImplTest_CallingChecksum_Test::TestBody() /proc/self/cwd/test/common/compressor/zlib_compressor_impl_test.cc:132:14
#7 0x478273e in void testing::internal::HandleSehExceptionsInMethodIfSupported(testing::Test*, void (testing::Test::*)(), char const*) /proc/self/cwd/external/com_google_googletest/googletest/src/gtest.cc:2424:10
#8 0x473ceff in void testing::internal::HandleExceptionsInMethodIfSupported(testing::Test*, void (testing::Test::*)(), char const*) /proc/self/cwd/external/com_google_googletest/googletest/src/gtest.cc:2460:14
#9 0x46f438b in testing::Test::Run() /proc/self/cwd/external/com_google_googletest/googletest/src/gtest.cc:2499:5
#10 0x46f6b56 in testing::TestInfo::Run() /proc/self/cwd/external/com_google_googletest/googletest/src/gtest.cc:2675:11
#11 0x46f86a0 in testing::TestSuite::Run() /proc/self/cwd/external/com_google_googletest/googletest/src/gtest.cc:2803:28
#12 0x472012e in testing::internal::UnitTestImpl::RunAllTests() /proc/self/cwd/external/com_google_googletest/googletest/src/gtest.cc:5241:44
#13 0x479254e in bool testing::internal::HandleSehExceptionsInMethodIfSupported(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /proc/self/cwd/external/com_google_googletest/googletest/src/gtest.cc:2424:10
#14 0x474704f in bool testing::internal::HandleExceptionsInMethodIfSupported(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /proc/self/cwd/external/com_google_googletest/googletest/src/gtest.cc:2460:14
#15 0x471f116 in testing::UnitTest::Run() /proc/self/cwd/external/com_google_googletest/googletest/src/gtest.cc:4843:10
#16 0x1b94866 in RUN_ALL_TESTS() /proc/self/cwd/external/com_google_googletest/googletest/include/gtest/gtest.h:2499:46
#17 0x1b93a5e in Envoy::TestRunner::RunTests(int, char**) /proc/self/cwd/./test/test_runner.h:57:12
#18 0x1b918b5 in main /proc/self/cwd/test/main.cc:39:10
#19 0x7f49e863282f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
#20 0x1991028 in _start (/build/tmp/_bazel_bazel/b570b5ccd0454dc9af9f65ab1833764d/execroot/envoy/bazel-out/k8-dbg/bin/test/common/compressor/compressor_test+0x1991028)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /build/tmp/_bazel_bazel/b570b5ccd0454dc9af9f65ab1833764d/execroot/envoy/external/com_github_madler_zlib/trees.c:873:42 in
```

Weirdly, in https://circleci.com/gh/envoyproxy/envoy/172899?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link, this didn't seem to cause any test failure, the respective test silently passed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.