Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash when running simple query #25

Closed
adizero opened this issue Aug 5, 2016 · 1 comment
Closed

crash when running simple query #25

adizero opened this issue Aug 5, 2016 · 1 comment

Comments

@adizero
Copy link

adizero commented Aug 5, 2016

cpsm crashes after executing following command (also crashes when doing the same search from Vim via ctrl-p integration):
echo "a/" | ./cpsm_cli.bin --query "a"

It looks like the trailing / in input filepath is causing the crash. Dump from glibc:

*** glibc detected *** /home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin: double free or corruption (!prev): 0x00007fbb7c000a50 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3469a75e66]
/lib64/libc.so.6[0x3469a789b3]
/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin(_ZN9__gnu_cxx13new_allocatorINS_17__normal_iteratorIPKcSt6vectorIcSaIcEEEEE10deallocateEPS7_m+0x20)[0x46e5b2]
/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin(_ZNSt12_Vector_baseIN9__gnu_cxx17__normal_iteratorIPKcSt6vectorIcSaIcEEEESaIS7_EE13_M_deallocateEPS7_m+0x32)[0x46a6ec]
/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin(ZNSt6vectorIN9__gnu_cxx17__normal_iteratorIPKcS_IcSaIcEEEESaIS6_EE19_M_emplace_back_auxIJRKS6_EEEvDpOT+0x120)[0x46ef18]
/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin(ZNSt6vectorIN9__gnu_cxx17__normal_iteratorIPKcS_IcSaIcEEEESaIS6_EE9push_backERKS6+0x69)[0x46b3ed]
/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin(_ZN4cpsm7MatcherINS_18PlatformPathTraitsENS_18SimpleStringTraitsEE32check_basename_match_word_prefixEv+0x30e)[0x4640ca]
/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin(_ZN4cpsm7MatcherINS_18PlatformPathTraitsENS_18SimpleStringTraitsEE5matchEN5boost16basic_string_refIcSt11char_traitsIcEEE+0x12f)[0x45da75]
/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin[0x44eb50]
/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin[0x451d9b]
/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin[0x456802]
/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin[0x4563a9]
/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin[0x4561f6]
/home/akocis/toolchains/lib64/libstdc++.so.6(+0xb4600)[0x7fbb82dae600]
/lib64/libpthread.so.0[0x3469e079d1]
/lib64/libc.so.6(clone+0x6d)[0x3469ae88fd]
======= Memory map: ========
00400000-0049b000 r-xp 00000000 fd:00 37362944 /home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin
0069a000-0069b000 rw-p 0009a000 fd:00 37362944 /home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin
00db2000-00dd3000 rw-p 00000000 00:00 0 [heap]
3469200000-3469220000 r-xp 00000000 fd:00 53477382 /lib64/ld-2.12.so
346941f000-3469420000 r--p 0001f000 fd:00 53477382 /lib64/ld-2.12.so
3469420000-3469421000 rw-p 00020000 fd:00 53477382 /lib64/ld-2.12.so
3469421000-3469422000 rw-p 00000000 00:00 0
3469600000-3469683000 r-xp 00000000 fd:00 53477443 /lib64/libm-2.12.so
3469683000-3469882000 ---p 00083000 fd:00 53477443 /lib64/libm-2.12.so
3469882000-3469883000 r--p 00082000 fd:00 53477443 /lib64/libm-2.12.so
3469883000-3469884000 rw-p 00083000 fd:00 53477443 /lib64/libm-2.12.so
3469a00000-3469b8a000 r-xp 00000000 fd:00 53477383 /lib64/libc-2.12.so
3469b8a000-3469d8a000 ---p 0018a000 fd:00 53477383 /lib64/libc-2.12.so
3469d8a000-3469d8e000 r--p 0018a000 fd:00 53477383 /lib64/libc-2.12.so
3469d8e000-3469d8f000 rw-p 0018e000 fd:00 53477383 /lib64/libc-2.12.so
3469d8f000-3469d94000 rw-p 00000000 00:00 0
3469e00000-3469e17000 r-xp 00000000 fd:00 53477390 /lib64/libpthread-2.12.so
3469e17000-346a017000 ---p 00017000 fd:00 53477390 /lib64/libpthread-2.12.so
346a017000-346a018000 r--p 00017000 fd:00 53477390 /lib64/libpthread-2.12.so
346a018000-346a019000 rw-p 00018000 fd:00 53477390 /lib64/libpthread-2.12.so
346a019000-346a01d000 rw-p 00000000 00:00 0
346a600000-346a607000 r-xp 00000000 fd:00 53477394 /lib64/librt-2.12.so
346a607000-346a806000 ---p 00007000 fd:00 53477394 /lib64/librt-2.12.so
346a806000-346a807000 r--p 00006000 fd:00 53477394 /lib64/librt-2.12.so
346a807000-346a808000 rw-p 00007000 fd:00 53477394 /lib64/librt-2.12.so
7fbb7c000000-7fbb7c021000 rw-p 00000000 00:00 0
7fbb7c021000-7fbb80000000 ---p 00000000 00:00 0
7fbb820dd000-7fbb820de000 ---p 00000000 00:00 0
7fbb820de000-7fbb82ae3000 rw-p 00000000 00:00 0
7fbb82ae3000-7fbb82af8000 r-xp 00000000 fd:00 18877079 /home/akocis/toolchains/lib64/libgcc_s.so.1
7fbb82af8000-7fbb82cf8000 ---p 00015000 fd:00 18877079 /home/akocis/toolchains/lib64/libgcc_s.so.1
7fbb82cf8000-7fbb82cf9000 rw-p 00015000 fd:00 18877079 /home/akocis/toolchains/lib64/libgcc_s.so.1
7fbb82cf9000-7fbb82cfa000 rw-p 00000000 00:00 0
7fbb82cfa000-7fbb82de5000 r-xp 00000000 fd:00 18877821 /home/akocis/toolchains/lib64/libstdc++.so.6.0.18
7fbb82de5000-7fbb82fe4000 ---p 000eb000 fd:00 18877821 /home/akocis/toolchains/lib64/libstdc++.so.6.0.18
7fbb82fe4000-7fbb82fec000 r--p 000ea000 fd:00 18877821 /home/akocis/toolchains/lib64/libstdc++.so.6.0.18
7fbb82fec000-7fbb82fee000 rw-p 000f2000 fd:00 18877821 /home/akocis/toolchains/lib64/libstdc++.so.6.0.18
7fbb82fee000-7fbb83003000 rw-p 00000000 00:00 0
7fbb83003000-7fbb83071000 r-xp 00000000 fd:00 18881170 /home/akocis/toolchains/boost/lib/libboost_program_options.so.1.61.0
7fbb83071000-7fbb83270000 ---p 0006e000 fd:00 18881170 /home/akocis/toolchains/boost/lib/libboost_program_options.so.1.61.0
7fbb83270000-7fbb83275000 rw-p 0006d000 fd:00 18881170 /home/akocis/toolchains/boost/lib/libboost_program_options.so.1.61.0
7fbb83275000-7fbb83276000 rw-p 00000000 00:00 0
7fbb83296000-7fbb83298000 rw-p 00000000 00:00 0
7fff0a774000-7fff0a791000 rw-p 00000000 00:00 0 [stack]
7fff0a7f2000-7fff0a7f3000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)

Core was generated by `/home/akocis/.vim/bundle/cpsm/build/cpsm_cli.bin --query a'.
Program terminated with signal SIGABRT, Aborted.
#0 0x0000003469a32625 in raise () from /lib64/libc.so.6

Current thread is 1 (Thread 0x7fbb82add700 (LWP 31474)) thread apply all where

Thread 2 (Thread 0x7fbb82adf720 (LWP 31473)):
#0 0x0000003469e0822d in pthread_join () from /lib64/libpthread.so.0
#1 0x00007fbb82dae3c7 in __gthread_join (__value_ptr=0x0, __threadid=) at /home/akocis/install/gcc-4.8.2-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu/bits/gthr-default.h:668
#2 std::thread::join (this=0xdd0760) at /home/akocis/install/gcc-4.8.2-build/../gcc-4.8.2/libstdc++-v3/src/c++11/thread.cc:107
#3 0x0000000000457cc2 in cpsm::Thread::join (this=0xdd0750) at /home/akocis/.vim/bundle/cpsm/src/par_util.h:58
#4 0x000000000044ef1e in cpsm::detail::for_each_match<cpsm::PlatformPathTraits, cpsm::SimpleStringTraits, cpsm::StringRefItem, cpsm::RangeSource<cpsm::StringRefItem, __gnu_cxx::normal_iterator<const std::basic_string_, std::vectorstd::basic_string > >, main(int, char)::__lambda4>(boost::string_ref, const cpsm::Options &, const cpsm::RangeSource<cpsm::StringRefItem, __gnu_cxx::_normal_iterator<std::basic_string<char, std::char_traits, std::allocator > const, std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > > > > &, const __lambda4 &) (query=..., opts=..., src=...,

dst=...) at /home/akocis/.vim/bundle/cpsm/src/api.h:284

#5 0x000000000044de46 in cpsm::for_each_match<cpsm::StringRefItem, cpsm::RangeSource<cpsm::StringRefItem, __gnu_cxx::normal_iterator<const std::basic_string_, std::vectorstd::basic_string > >, main(int, char)::__lambda4>(boost::string_ref, const cpsm::Options &, const cpsm::RangeSource<cpsm::StringRefItem, __gnu_cxx::_normal_iterator<std::basic_string<char, std::char_traits, std::allocator > const, std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > > > > &, const __lambda4 &) (query=..., opts=..., src=..., dst=...) at /home/akocis/.vim/bundle/cpsm/src/api.h:159
#6 0x000000000044db63 in main (argc=3, argv=0x7fff0a787638) at /home/akocis/.vim/bundle/cpsm/src/cpsm_cli_main.cc:74

Thread 1 (Thread 0x7fbb82add700 (LWP 31474)):
#0 0x0000003469a32625 in raise () from /lib64/libc.so.6
#1 0x0000003469a33e05 in abort () from /lib64/libc.so.6
#2 0x0000003469a70537 in __libc_message () from /lib64/libc.so.6
#3 0x0000003469a75e66 in malloc_printerr () from /lib64/libc.so.6
#4 0x0000003469a789b3 in _int_free () from /lib64/libc.so.6
#5 0x000000000046e5b2 in __gnu_cxx::new_allocator<__gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator > > >::deallocate (this=0x7fbb82adcc28, __p=0x7fbb7c000a50) at /home/akocis/toolchains/include/c++/4.8.2/ext/new_allocator.h:110
#6 0x000000000046a6ec in std::_Vector_base<__gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator > >, std::allocator<__gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator > > > >::_M_deallocate (this=0x7fbb82adcc28, __p=0x7fbb7c000a50, __n=1)

at /home/akocis/toolchains/include/c++/4.8.2/bits/stl_vector.h:174

#7 0x000000000046ef18 in std::vector<__gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator > >, std::allocator<__gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator > > > >::_M_emplace_back_aux<__gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator > > const&> (this=0x7fbb82adcc28)

at /home/akocis/toolchains/include/c++/4.8.2/bits/vector.tcc:430

#8 0x000000000046b3ed in std::vector<__gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator > >, std::allocator<__gnu_cxx::__normal_iterator<char const*, std::vector<char, std::allocator > > > >::push_back (this=0x7fbb82adcc28, __x=97 'a') at /home/akocis/toolchains/include/c++/4.8.2/bits/stl_vector.h:911
#9 0x00000000004640ca in cpsm::Matcher<cpsm::PlatformPathTraits, cpsm::SimpleStringTraits>::check_basename_match_word_prefix (this=0x7fbb82adcbe0) at /home/akocis/.vim/bundle/cpsm/src/matcher.h:459
#10 0x000000000045da75 in cpsm::Matcher<cpsm::PlatformPathTraits, cpsm::SimpleStringTraits>::match (this=0x7fbb82adcbe0, item=...) at /home/akocis/.vim/bundle/cpsm/src/matcher.h:146
#11 0x000000000044eb50 in cpsm::detail::__lambda3::operator() (__closure=0xdd0a50) at /home/akocis/.vim/bundle/cpsm/src/api.h:261
#12 0x0000000000451d9b in cpsm::Thread::run<cpsm::detail::for_each_match(boost::string_ref, const cpsm::Options&, const Source&, const Sink&) [with PathTraits = cpsm::PlatformPathTraits; StringTraits = cpsm::SimpleStringTraits; Item = cpsm::StringRefItem; Source = cpsm::RangeSource<cpsm::StringRefItem, __gnu_cxx::__normal_iterator<const std::basic_string, std::vectorstd::basic_string > >; Sink = main(int, char)::__lambda4; boost::string_ref = boost::basic_string_ref<char, std::char_traits >]::__lambda3>(cpsm::Thread , const cpsm::detail::__lambda3 &) (thread=0xdd0750, f=...) at /home/akocis/.vim/bundle/cpsm/src/par_util.h:68
#13 0x0000000000456802 in std::_Bind_simple<void (
(cpsm::Thread
, cpsm::detail::for_each_match(boost::string_ref, const cpsm::Options&, const Source&, const Sink&) [with PathTraits = cpsm::PlatformPathTraits; StringTraits = cpsm::SimpleStringTraits; Item = cpsm::StringRefItem; Source = cpsm::RangeSource<cpsm::StringRefItem, __gnu_cxx::normal_iterator<const std::basic_string_, std::vectorstd::basic_string > >; Sink = main(int, char)::__lambda4; boost::string_ref = boost::basic_string_ref<char, std::char_traits >]::_lambda3))(cpsm::Thread, const cpsm::detail::for_each_match(boost::string_ref, const cpsm::Options&, const Source&, const Sink&) [with PathTraits = cpsm::PlatformPathTraits; StringTraits = cpsm::SimpleStringTraits; Item = cpsm::StringRefItem; Source = cpsm::RangeSource<cpsm::StringRefItem, __gnu_cxx::__normal_iterator<const std::basic_string, std::vectorstd::basic_string > >; Sink = main(int, char)::__lambda4; boost::string_ref = boost::basic_string_ref<char, std::char_traits >]::__lambda3&)>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (this=0xdd0a50) at /home/akocis/toolchains/include/c++/4.8.2/functional:1732
#14 0x00000000004563a9 in std::_Bind_simple<void (
(cpsm::Thread*, cpsm::detail::for_each_match(boost::string_ref, const cpsm::Options&, const Source&, const Sink&) [with PathTraits = cpsm::PlatformPathTraits; StringTraits = cpsm::SimpleStringTraits; Item = cpsm::StringRefItem; Source = cpsm::RangeSource<cpsm::StringRefItem, __gnu_cxx::normal_iterator<const std::basic_string_, std::vectorstd::basic_string > >; Sink = main(int, char)::__lambda4; boost::string_ref = boost::basic_string_ref<char, std::char_traits >]::_lambda3))(cpsm::Thread, const cpsm::detail::for_each_match(boost::string_ref, const cpsm::Options&, const Source&, const Sink&) [with PathTraits = cpsm::PlatformPathTraits; StringTraits = cpsm::SimpleStringTraits; Item = cpsm::StringRefItem; Source = cpsm::RangeSource<cpsm::StringRefItem, __gnu_cxx::__normal_iterator<const std::basic_string, std::vectorstd::basic_string > >; Sink = main(int, char*)::__lambda4; boost::string_ref = boost::basic_string_ref<char, std::char_traits >]::__lambda3&)>::operator()(void) (

this=0xdd0a50) at /home/akocis/toolchains/include/c++/4.8.2/functional:1720

#15 0x00000000004561f6 in std::thread::Impl<std::Bind_simple<void ((cpsm::Thread, cpsm::detail::for_each_match(boost::string_ref, const cpsm::Options&, const Source&, const Sink&) [with PathTraits = cpsm::PlatformPathTraits; StringTraits = cpsm::SimpleStringTraits; Item = cpsm::StringRefItem; Source = cpsm::RangeSource<cpsm::StringRefItem, __gnu_cxx::__normal_iterator<const std::basic_string, std::vectorstd::basic_string > >; Sink = main(int, char_)::__lambda4; boost::string_ref = boost::basic_string_ref<char, std::char_traits >]::_lambda3))(cpsm::Thread, const cpsm::detail::for_each_match(boost::string_ref, const cpsm::Options&, const Source&, const Sink&) [with PathTraits = cpsm::PlatformPathTraits; StringTraits = cpsm::SimpleStringTraits; Item = cpsm::StringRefItem; Source = cpsm::RangeSource<cpsm::StringRefItem, __gnu_cxx::__normal_iterator<const std::basic_string, std::vectorstd::basic_string > >; Sink = main(int, char*)::__lambda4; boost::string_ref = boost::basic_string_ref<char, std::char_traits >]::__lambda3&)> >::_M_run(void) (this=0xdd0a38) at /home/akocis/toolchains/include/c++/4.8.2/thread:115
#16 0x00007fbb82dae600 in std::(anonymous namespace)::execute_native_thread_routine (__p=) at /home/akocis/install/gcc-4.8.2-build/../gcc-4.8.2/libstdc++-v3/src/c++11/thread.cc:84
#17 0x0000003469e079d1 in start_thread () from /lib64/libpthread.so.0
#18 0x0000003469ae88fd in clone () from /lib64/libc.so.6

@nixprime
Copy link
Owner

Thanks for the bug report!

nixprime added a commit that referenced this issue Aug 10, 2016
…_prefix

This assumption was true at an earlier point in 3ff1f5d's
development, but is true no longer.

Fixes #24, #25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants