opentechinstitute / commotiond

The system management daemon for the Commotion Wireless Project.
https://commotionwireless.net
GNU Affero General Public License v3.0
26 stars 21 forks source link

co_set_str causes segfault in size 32 tree #90

Closed gradyoti closed 10 years ago

gradyoti commented 10 years ago

On size 32 tree when calling co_tree_set_str Does not occur with size 16.

Specific input: TestString1 = co_str8_create("1TESTVALUE1", 12, 0);

ret = co_tree_insert(Tree32, "1TESTKEY1", 9, TestString1); ASSERT_EQ(1, ret);

ret = co_tree_set_str(Tree32, "1TESTKEY1", 9, "REPLACESTRING", 8); ASSERT_EQ(1, ret);

Valgrind output: ==8934== Process terminating with default action of signal 11 (SIGSEGV) ==8934== Access not within mapped region at address 0x15 ==8934== at 0x4C2E893: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==8934== by 0x4E4BF12: _co_node_set_str (tree.c:364) ==8934== by 0x4E4C3A6: co_tree_set_str (tree.c:403) ==8934== by 0x4383E5: TreeTest::UpdateObj() (tree.cpp:173) ==8934== by 0x438791: TreeTest_TreeUpdateTestTest::TestBody() (tree.cpp:192) ==8934== by 0x45DD87: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test, void (testing::Test::)(), char const) (in /home/gj/src/commotiond/build/tests/commotiontest) ==8934== by 0x458F77: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test, void (testing::Test::)(), char const) (in /home/gj/src/commotiond/build/tests/commotion_test) ==8934== by 0x440304: testing::Test::Run() (in /home/gj/src/commotiond/build/tests/commotion_test) ==8934== by 0x440AE1: testing::TestInfo::Run() (in /home/gj/src/commotiond/build/tests/commotion_test) ==8934== by 0x44117B: testing::TestCase::Run() (in /home/gj/src/commotiond/build/tests/commotion_test) ==8934== by 0x447941: testing::internal::UnitTestImpl::RunAllTests() (in /home/gj/src/commotiond/build/tests/commotiontest) ==8934== by 0x45F165: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl, bool (testing::internal::UnitTestImpl::_)(), char const*) (in /home/gj/src/commotiond/build/tests/commotion_test) ==8934== If you believe this happened as a result of a stack ==8934== overflow in your program's main thread (unlikely but ==8934== possible), you can try to increase the size of the ==8934== main thread stack using the --main-stacksize= flag. ==8934== The main thread stack size used in this run was 8388608.

areynold commented 10 years ago

@gradyoti Is this resolved by #103?

gradyoti commented 10 years ago

Yep! Resolved.

jheretic commented 10 years ago

Resolved per #103