You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "Kezhu Wang (Jira)" <ji...@apache.org> on 2024/09/10 10:55:00 UTC
[jira] [Updated] (ZOOKEEPER-4733) non-return function error and asan error in CPPUNIT TESTs
[ https://issues.apache.org/jira/browse/ZOOKEEPER-4733?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kezhu Wang updated ZOOKEEPER-4733:
----------------------------------
Component/s: tests
> non-return function error and asan error in CPPUNIT TESTs
> ----------------------------------------------------------
>
> Key: ZOOKEEPER-4733
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4733
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client, tests
> Affects Versions: 3.8.2
> Environment: gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
> Reporter: whyer
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> when enable Werror=return-type check in gcc, the following error occurs:
> {quote}zookeeper/zookeeper-client/zookeeper-client-c/tests/ZooKeeperQuorumServer.cc: In static member function ‘static std::vector<ZooKeeperQuorumServer*> ZooKeeperQuorumServer::getCluster(uint32_t, ZooKeeperQuorumServer::tConfigPairs, std::__cxx11::string)’:
> zookeeper/zookeeper-client/zookeeper-client-c/tests/ZooKeeperQuorumServer.cc:230:1: error: control reaches end of non-void function [-Werror=return-type]
> }{quote}
> when enable asan option on cppunit test, the following error occurs:
> {quote}1: Zookeeper_reconfig::testMigrationCycle=================================================================
> 1: ==415554==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60d00000cf6f at pc 0x560905cbbd12 bp 0x7ffe32d10af0 sp 0x7ffe32d10ae8
> 1: READ of size 1 at 0x60d00000cf6f thread T0
> 1: #0 0x560905cbbd11 in Zookeeper_reconfig::testMigrationCycle() zookeeper/zookeeper-client/zookeeper-client-c/tests/TestReconfig.cc:502
> 1: #1 0x560905cc21a1 in CppUnit::TestCaller<Zookeeper_reconfig>::runTest() /usr/include/cppunit/TestCaller.h:166
> 1: #2 0x7fb8248815b1 in CppUnit::TestCaseMethodFunctor::operator()() const (/usr/lib/x86_64-linux-gnu/libcppunit-1.13.so.0+0x235b1)
> 1: #3 0x7fb824877eb2 in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) (/usr/lib/x86_64-linux-gnu/libcppunit-1.13.so.0+0x19eb2)
> 1: #4 0x7fb82487e7e1 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) (/usr/lib/x86_64-linux-gnu/libcppunit-1.13.so.0+0x207e1)
> 1: #5 0x7fb824886e4f in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (/usr/lib/x86_64-linux-gnu/libcppunit-1.13.so.0+0x28e4f)
> 1: #6 0x7fb82488138f in CppUnit::TestCase::run(CppUnit::TestResult*) (/usr/lib/x86_64-linux-gnu/libcppunit-1.13.so.0+0x2338f)
> 1: #7 0x7fb8248818e2 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) (/usr/lib/x86_64-linux-gnu/libcppunit-1.13.so.0+0x238e2)
> 1: #8 0x7fb8248817fd in CppUnit::TestComposite::run(CppUnit::TestResult*) (/usr/lib/x86_64-linux-gnu/libcppunit-1.13.so.0+0x237fd)
> 1: #9 0x7fb8248818e2 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) (/usr/lib/x86_64-linux-gnu/libcppunit-1.13.so.0+0x238e2)
> 1: #10 0x7fb8248817fd in CppUnit::TestComposite::run(CppUnit::TestResult*) (/usr/lib/x86_64-linux-gnu/libcppunit-1.13.so.0+0x237fd)
> 1: #11 0x7fb824886d71 in CppUnit::TestResult::runTest(CppUnit::Test*) (/usr/lib/x86_64-linux-gnu/libcppunit-1.13.so.0+0x28d71)
> 1: #12 0x7fb82488947d in CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (/usr/lib/x86_64-linux-gnu/libcppunit-1.13.so.0+0x2b47d)
> 1: #13 0x560905c918a5 in main zookeeper/zookeeper-client/zookeeper-client-c/tests/TestDriver.cc:152
> 1: #14 0x7fb8230b42e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
> 1: #15 0x560905c914c9 in _start (build/zookeeper/zookeeper-client/zookeeper-client-c/zktest+0x154c9)
> 1:
> 1: 0x60d00000cf6f is located 1 bytes to the left of 138-byte region [0x60d00000cf70,0x60d00000cffa)
> 1: allocated by thread T0 here:
> 1: #0 0x7fb824b5fbf0 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc2bf0)
> 1: #1 0x7fb823a5f1f6 (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x1111f6)
> 1: #2 0x7fb823a5bcb9 in std::ostream& std::ostream::_M_insert<unsigned long>(unsigned long) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x10dcb9)
> 1: #3 0x7ffe32d1090f (<unknown module>)
> 1:
> 1: SUMMARY: AddressSanitizer: heap-buffer-overflow zookeeper/zookeeper-client/zookeeper-client-c/tests/TestReconfig.cc:502 in Zookeeper_reconfig::testMigrationCycle()
> 1: Shadow bytes around the buggy address:
> 1: 0x0c1a7fff9990: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
> 1: 0x0c1a7fff99a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
> 1: 0x0c1a7fff99b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
> 1: 0x0c1a7fff99c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
> 1: 0x0c1a7fff99d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
> 1: =>0x0c1a7fff99e0: fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]00 00
> 1: 0x0c1a7fff99f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02
> 1: 0x0c1a7fff9a00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
> 1: 0x0c1a7fff9a10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
> 1: 0x0c1a7fff9a20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
> 1: 0x0c1a7fff9a30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
> 1: Shadow byte legend (one shadow byte represents 8 application bytes):
> 1: Addressable: 00
> 1: Partially addressable: 01 02 03 04 05 06 07
> 1: Heap left redzone: fa
> 1: Heap right redzone: fb
> 1: Freed heap region: fd
> 1: Stack left redzone: f1
> 1: Stack mid redzone: f2
> 1: Stack right redzone: f3
> 1: Stack partial redzone: f4
> 1: Stack after return: f5
> 1: Stack use after scope: f8
> 1: Global redzone: f9
> 1: Global init order: f6
> 1: Poisoned by user: f7
> 1: Container overflow: fc
> 1: Array cookie: ac
> 1: Intra object redzone: bb
> 1: ASan internal: fe
> 1: Left alloca redzone: ca
> 1: Right alloca redzone: cb
> 1: ==415554==ABORTING
> 1/1 Test #1: zktest_runner ....................***Failed 1.42 sec{quote}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)