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

Segfault in std::string::empty() / ledger::account_t::fullname (BZ#977) #977

Open
tbm opened this issue Jun 21, 2013 · 1 comment
Open
Labels
bug Something isn't working P3 Average priority

Comments

@tbm
Copy link
Contributor

tbm commented Jun 21, 2013

Note: the issue was created automatically with bugzilla2github

Bugzilla bug ID: BZ#977
From: Martin Michlmayr (@tbm)

@tbm
Copy link
Contributor Author

tbm commented Jun 21, 2013

Comment author: Martin Michlmayr (@tbm)

Segfault related to ledger.session.close_journal_files() and running a function after calling this function. However, the segfault doesn't happen with any input file. The input below will trigger the segfault.

Python file:

import ledger

journal = ledger.read_journal("d")
ledger.session.close_journal_files()
account = journal.find_account_re("foo")

Input file "d":

2012-01-04 * foo foo foo foo foo foo foo foo foo foo foo foo foo foo
Assets:A 273.57 GBP
Assets:B

2012-01-04 * bar bar bar bar bar bar bar bar bar bar bar bar bar bar
; Fund: bar
Assets:A 86.39 GBP
Assets:B

Program received signal SIGSEGV, Segmentation fault.
0xf78363b6 in std::string::empty() const () from /usr/lib/i386-linux-gnu/libstdc++.so.6
(gdb) where
#0 0xf78363b6 in std::string::empty() const () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#1 0x089f5aa3 in ledger::account_t::fullname (this=0x8de0268) at /home/tbm/ledger/src/account.cc:155
#2 0x089f5730 in ledger::(anonymous namespace)::find_account_re_ (account=0x8de0268, regexp=...)
at /home/tbm/ledger/src/account.cc:112
#3 0x089f599f in ledger::account_t::find_account_re (this=0x8de0268, regexp=...) at /home/tbm/ledger/src/account.cc:125
#4 0x089dd66a in ledger::journal_t::find_account_re (this=0x926ae58, regexp=...) at /home/tbm/ledger/src/journal.cc:118
#5 0x08c19125 in boost::python::detail::invoke<boost::python::to_python_indirect<ledger::account_t*, boost::python::detail::make_reference_holder>, ledger::account_t* (ledger::journal_t::)(std::string const&), boost::python::arg_from_pythonledger::journal_t&, boost::python::arg_from_python<std::string const&> > (rc=..., f=
@ 0x92ff6c4: (ledger::account_t (ledger::journal_t::)(ledger::journal_t * const, const std::basic_string<char, std::char_traits, std::allocator > &)) 0x89dd650 <ledger::journal_t::find_account_re(std::string const&)>, tc=..., ac0=...)
at /usr/include/boost/python/detail/invoke.hpp:88
#6 0x08c165c9 in boost::python::detail::caller_arity<2u>::impl<ledger::account_t
(ledger::journal_t::)(std::string const&), boost::python::return_internal_reference<1u, boost::python::with_custodian_and_ward_postcall<1u, 0u, boost::python::default_call_policies> >, boost::mpl::vector3<ledger::account_t, ledger::journal_t&, std::string const&> >::operator() (this=0x92ff6c4, args_=0xf619016c)
at /usr/include/boost/python/detail/caller.hpp:223
#7 0x08c14cdc in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<ledger::account_t* (ledger::journal_t::)(std::string const&), boost::python::return_internal_reference<1u, boost::python::with_custodian_and_ward_postcall<1u, 0u, boost::python::default_call_policies> >, boost::mpl::vector3<ledger::account_t, ledger::journal_t&, std::string const&> > >::operator() (
this=0x92ff6c0, args=0xf619016c, kw=0x0) at /usr/include/boost/python/object/py_function.hpp:38
#8 0xf7cce454 in boost::python::objects::function::call(_object*, _object*) const () from /usr/lib/libboost_python-py27.so.1.49.0
#9 0xf7cce7f7 in ?? () from /usr/lib/libboost_python-py27.so.1.49.0
#10 0xf7cd783a in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/lib/libboost_python-py27.so.1.49.0
#11 0x08c11791 in boost::python::detail::translate_exception<ledger::error_count, void ()(ledger::error_count const&)>::operator() (
this=0x92ff4f4, handler=..., f=..., translate=0x8c05591 <ledger::exc_translate_error_count(ledger::error_count const&)>)
at /usr/include/boost/python/detail/translate_exception.hpp:48
#12 0x08c108cc in boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (
)(ledger::error_count const&)> >::operator()<bool, boost::python::detail::translate_exception<ledger::error_count, void ()(ledger::error_count const&)>, boost::_bi::list2<boost::python::detail::exception_handler const&, boost::function0 const&> > (this=0x92ff4f8, f=..., a=...)
at /usr/include/boost/bind/bind.hpp:382
#13 0x08c0f89c in boost::_bi::bind_t<bool, boost::python::detail::translate_exception<ledger::error_count, void (
)(ledger::error_count const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void ()(ledger::error_count const&)> > >::operator()<boost::python::detail::exception_handler, boost::function0 > (this=0x92ff4f4, a1=..., a2=...)
at /usr/include/boost/bind/bind_template.hpp:102
---Type to continue, or q to quit---
#14 0x08c0e8de in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<ledger::error_count, void (
)(ledger::error_count const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void ()(ledger::error_count const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke (
function_obj_ptr=..., a0=..., a1=...) at /usr/include/boost/function/function_template.hpp:132
#15 0xf7cd7813 in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/lib/libboost_python-py27.so.1.49.0
#16 0x08c1161f in boost::python::detail::translate_exception<ledger::parse_error, void (
)(ledger::parse_error const&)>::operator() (
this=0x92ff4dc, handler=..., f=..., translate=0x8c05565 <ledger::exc_translate_parse_error(ledger::parse_error const&)>)
at /usr/include/boost/python/detail/translate_exception.hpp:48
#17 0x08c107d2 in boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void ()(ledger::parse_error const&)> >::operator()<bool, boost::python::detail::translate_exception<ledger::parse_error, void ()(ledger::parse_error const&)>, boost::_bi::list2<boost::python::detail::exception_handler const&, boost::function0 const&> > (this=0x92ff4e0, f=..., a=...)
at /usr/include/boost/bind/bind.hpp:382
#18 0x08c0f7bc in boost::_bi::bind_t<bool, boost::python::detail::translate_exception<ledger::parse_error, void ()(ledger::parse_error const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void ()(ledger::parse_error const&)> > >::operator()<boost::python::detail::exception_handler, boost::function0 > (this=0x92ff4dc, a1=..., a2=...)
at /usr/include/boost/bind/bind_template.hpp:102
#19 0x08c0e80e in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<ledger::parse_error, void ()(ledger::parse_error const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void ()(ledger::parse_error const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke (
function_obj_ptr=..., a0=..., a1=...) at /usr/include/boost/function/function_template.hpp:132
#20 0xf7cd7813 in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/lib/libboost_python-py27.so.1.49.0
#21 0x08bb03f9 in boost::python::detail::translate_exception<ledger::balance_error, void ()(ledger::balance_error const&)>::operator()
(this=0x92f8824, handler=..., f=..., translate=0x8ba7984 <ledger::exc_translate_balance_error(ledger::balance_error const&)>)
at /usr/include/boost/python/detail/translate_exception.hpp:48
#22 0x08bafb02 in boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (
)(ledger::balance_error const&)> >::operator()<bool, boost::python::detail::translate_exception<ledger::balance_error, void ()(ledger::balance_error const&)>, boost::_bi::list2<boost::python::detail::exception_handler const&, boost::function0 const&> > (this=0x92f8828, f=..., a=...)
at /usr/include/boost/bind/bind.hpp:382
#23 0x08bae746 in boost::_bi::bind_t<bool, boost::python::detail::translate_exception<ledger::balance_error, void (
)(ledger::balance_error const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void ()(ledger::balance_error const&)> > >::operator()<boost::python::detail::exception_handler, boost::function0 > (this=0x92f8824, a1=..., a2=...)
at /usr/include/boost/bind/bind_template.hpp:102
#24 0x08bad2d6 in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<ledger::balance_error, void (
)(ledger::balance_error const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void ()(ledger::balance_error const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke (
function_obj_ptr=..., a0=..., a1=...) at /usr/include/boost/function/function_template.hpp:132
#25 0xf7cd7813 in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/lib/libboost_python-py27.so.1.49.0
#26 0x08c5dbbb in boost::python::detail::translate_exception<ledger::value_error, void (
)(ledger::value_error const&)>::operator() (
this=0x92ee064, handler=..., f=..., translate=0x8c4a5ae <ledger::exc_translate_value_error(ledger::value_error const&)>)
at /usr/include/boost/python/detail/translate_exception.hpp:48
#27 0x08c5cd78 in boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void ()(ledger::value_error const&)> >::operator()<bool, boost::python::detail::translate_exception<ledger::value_error, void ()(ledger::value_error const&)>, boost::_bi::list2<boost::python::detail::exception_handler const&, boost::function0 const&> > (this=0x92ee068, f=..., a=...)
at /usr/include/boost/bind/bind.hpp:382
#28 0x08c5a666 in boost::_bi::bind_t<bool, boost::python::detail::translate_exception<ledger::value_error, void ()(ledger::value_error const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void ()(ledger::value_error const&)> > >::operator()<boost::python::detail::exception_handler, boost::function0 > (this=0x92ee064, a1=..., a2=...)
at /usr/include/boost/bind/bind_template.hpp:102
#29 0x08c577c4 in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<ledger::value_error, void ()(ledger::value_error const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void ()(ledger::value_error const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke (
function_obj_ptr=..., a0=..., a1=...) at /usr/include/boost/function/function_template.hpp:132
#30 0xf7cd7813 in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/lib/libboost_python-py27.so.1.49.0
#31 0x08b98df7 in boost::python::detail::translate_exception<ledger::amount_error, void ()(ledger::amount_error const&)>::operator() (
this=0x928edfc, handler=..., f=..., translate=0x8b8a90d <ledger::exc_translate_amount_error(ledger::amount_error const&)>)
at /usr/include/boost/python/detail/translate_exception.hpp:48
#32 0x08b982b4 in boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (
)(ledger::amount_error const&)> >::operator()<bool, boost::python::detail::translate_exception<ledger::amount_error, void ()(ledger::amount_error const&)>, boost::_bi::list2<boost::python::detail::exception_handler const&, boost::function0 const&> > (this=0x928ee00, f=..., a=...)
at /usr/include/boost/bind/bind.hpp:382
#33 0x08b96afc in boost::_bi::bind_t<bool, boost::python::detail::translate_exception<ledger::amount_error, void (
)(ledger::amount_error const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void ()(ledger::amount_error const&)> > >::operator()<boost::python::detail::exception_handler, boost::function0 > (this=0x928edfc, a1=..., a2=...)
at /usr/include/boost/bind/bind_template.hpp:102
#34 0x08b9495c in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<ledger::amount_error, void (
)(ledger::amount_error const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (*)(le---Type to continue, or q to quit---
dger::amount_error const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke (
function_obj_ptr=..., a0=..., a1=...) at /usr/include/boost/function/function_template.hpp:132
#35 0xf7cd7618 in boost::python::handle_exception_impl(boost::function0) () from /usr/lib/libboost_python-py27.so.1.49.0
#36 0xf7cccbc3 in ?? () from /usr/lib/libboost_python-py27.so.1.49.0
#37 0xf7ae5800 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#38 0xf7a0a39d in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#39 0xf7a0f3a2 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#40 0xf7a0f4e3 in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
#41 0xf7a551b1 in PyRun_FileExFlags () from /usr/lib/libpython2.7.so.1.0
#42 0xf7a55661 in PyRun_SimpleFileExFlags () from /usr/lib/libpython2.7.so.1.0
#43 0xf7a56200 in PyRun_AnyFileExFlags () from /usr/lib/libpython2.7.so.1.0
#44 0xf7a56f56 in Py_Main () from /usr/lib/libpython2.7.so.1.0
#45 0x08af2bbb in ledger::python_interpreter_t::python_command (this=0x926afc8, args=...) at /home/tbm/ledger/src/pyinterp.cc:337
#46 0x08afa110 in boost::_mfi::mf1<ledger::value_t, ledger::python_interpreter_t, ledger::call_scope_t&>::operator() (this=0xffffd090,
p=0x926afc8, a1=...) at /usr/include/boost/bind/mem_fn_template.hpp:165
#47 0x08af9a7f in boost::_bi::list2<boost::_bi::valueledger::python_interpreter_t*, boost::arg<1> >::operator()<ledger::value_t, boost::_mfi::mf1<ledger::value_t, ledger::python_interpreter_t, ledger::call_scope_t&>, boost::_bi::list1ledger::call_scope_t& > (
this=0xffffd098, f=..., a=...) at /usr/include/boost/bind/bind.hpp:303
#48 0x08af9545 in boost::_bi::bind_t<ledger::value_t, boost::_mfi::mf1<ledger::value_t, ledger::python_interpreter_t, ledger::call_scope_t&>, boost::_bi::list2<boost::_bi::valueledger::python_interpreter_t*, boost::arg<1> > >::operator()ledger::call_scope_t (
this=0xffffd090, a1=...) at /usr/include/boost/bind/bind_template.hpp:32
#49 0x08af9054 in boost::detail::function::function_obj_invoker1<boost::_bi::bind_t<ledger::value_t, boost::_mfi::mf1<ledger::value_t, ledger::python_interpreter_t, ledger::call_scope_t&>, boost::_bi::list2<boost::_bi::valueledger::python_interpreter_t*, boost::arg<1> > >, ledger::value_t, ledger::call_scope_t&>::invoke (function_obj_ptr=..., a0=...)
at /usr/include/boost/function/function_template.hpp:132
#50 0x0895a6a1 in boost::function1<ledger::value_t, ledger::call_scope_t&>::operator() (this=0xffffd08c, a0=...)
at /usr/include/boost/function/function_template.hpp:760
#51 0x08946c85 in ledger::global_scope_t::execute_command (this=0x926ac10, args=..., at_repl=false)
at /home/tbm/ledger/src/global.cc:260
#52 0x08946ec6 in ledger::global_scope_t::execute_command_wrapper (this=0x926ac10, args=..., at_repl=false)
at /home/tbm/ledger/src/global.cc:270
#53 0x0892b1f1 in main (argc=3, argv=0xffffd864, envp=0xffffd874) at /home/tbm/ledger/src/main.cc:121

@tbm tbm added P3 Average priority bug Something isn't working labels May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P3 Average priority
Projects
None yet
Development

No branches or pull requests

1 participant