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 when using ledger print: std::__cxx11::basic_string / boost::u32regex_search #1850

Closed
Panke opened this issue Jan 7, 2020 · 3 comments
Closed
Labels
bug

Comments

@Panke
Copy link
Contributor

@Panke Panke commented Jan 7, 2020

ledger print -f test.txt gives a segfault. test.txt:

= expr payee =~ /Max/ & account =~ /Expenses:Unknown/
	Expenses:Rent  1
	Expenses:Unknown  -1

account Expenses:Car
	payee SB Tank


2019/12/30 * Max Mustermann  ; Rent
    Expenses:Unknown                        650,00
    Assets:Checking                             -650,00 €

Note that there is no segfault if:

  • the regex does not match the payee
  • Expenses:Unknown is not used in the automatic transaction
  • The account declaration for Expenses:Car is removed

Ledger 3.1.3-20190331, the command-line accounting tool

@tbm

This comment has been minimized.

Copy link
Contributor

@tbm tbm commented Jan 7, 2020

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7006240 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::begin() const ()
   from /lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) where
#0  0x00007ffff7006240 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::begin() const ()
   from /lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00007ffff7b42ac7 in boost::u32regex_search (s=<error reading variable: Cannot access memory at address 0x148>, e=..., 
    flags=boost::regex_constants::match_default) at /usr/include/boost/regex/icu.hpp:758
#2  0x00007ffff7b436d0 in ledger::mask_t::match (this=0x555555712100, text=<error reading variable: Cannot access memory at address 0x148>)
    at src/mask.h:90
#3  0x00007ffff7c6b1d3 in ledger::journal_t::register_account (this=0x5555556facd0, name="Expenses:Unknown", post=0x555555715920, master_account=
    0x5555556fb830) at src/journal.cc:139
#4  0x00007ffff7c8806b in ledger::auto_xact_t::extend_xact (this=0x555555710a30, xact=..., context=...) at src/xact.cc:793
#5  0x00007ffff7c6de36 in ledger::journal_t::extend_xact (this=0x5555556facd0, xact=0x5555557025f0) at src/journal.cc:445
#6  0x00007ffff7c6cb33 in ledger::journal_t::add_xact (this=0x5555556facd0, xact=0x5555557025f0) at src/journal.cc:371
#7  0x00007ffff7c4ac25 in ledger::(anonymous namespace)::instance_t::xact_directive (this=0x7fffffffa370, line=0x555555707a78 "    Assets:Checking", len=35)
    at src/textual.cc:710
#8  0x00007ffff7c47bde in ledger::(anonymous namespace)::instance_t::read_next_directive (this=0x7fffffffa370, error_flag=@0x7fffffff9e8f: false)
    at src/textual.cc:381
#9  0x00007ffff7c4699f in ledger::(anonymous namespace)::instance_t::parse (this=0x7fffffffa370) at src/textual.cc:252
#10 0x00007ffff7c55c6d in ledger::journal_t::read_textual (this=0x5555556facd0, context_stack=...) at src/textual.cc:2002
#11 0x00007ffff7c6e070 in ledger::journal_t::read (this=0x5555556facd0, context=...) at src/journal.cc:485
#12 0x00007ffff7c1ee18 in ledger::session_t::read_data (this=0x5555556faf60, master_account="") at src/session.cc:171
#13 0x00007ffff7c1f6da in ledger::session_t::read_journal_files (this=0x5555556faf60) at src/session.cc:203
#14 0x000055555564ca4a in ledger::global_scope_t::execute_command (this=0x5555556fa740, args=std::__cxx11::list = {...}, at_repl=false)
    at src/global.cc:226
#15 0x000055555564d0a5 in ledger::global_scope_t::execute_command_wrapper (this=0x5555556fa740, args=std::__cxx11::list = {...}, at_repl=false)
    at src/global.cc:271
#16 0x000055555562a237 in main (argc=4, argv=0x7fffffffda68, envp=0x7fffffffda90) at src/main.cc:122
@tbm tbm changed the title Segfault when using ledger print Segfault when using ledger print: std::__cxx11::basic_string / boost::u32regex_search Jan 7, 2020
@tbm tbm added the bug label Jan 7, 2020
@Panke

This comment has been minimized.

Copy link
Contributor Author

@Panke Panke commented Jan 7, 2020

@tbm Thanks for adding the backtrace, should have done so myself

Panke added a commit to Panke/ledger that referenced this issue Jan 8, 2020
@Panke

This comment has been minimized.

Copy link
Contributor Author

@Panke Panke commented Jan 8, 2020

@jwiegley jwiegley closed this in b2483e7 Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.