mridoni / gixsql

GixSQL is an ESQL preprocessor and a series of runtime libraries to enable GnuCOBOL to access PostgreSQL, ODBC, MySQL, Oracle and SQLite databases.
GNU General Public License v3.0
16 stars 8 forks source link

abort during processing (1.0.20) #150

Open GitMensch opened 1 year ago

GitMensch commented 1 year ago

error:

terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 15) >= this->size() (which is 15)

backtrace:

#6  0x00007ffff7ad106b in std::__throw_out_of_range_fmt(char const*, ...) [clone .cold.5] () from /usr/lib64/libstdc++.so.6
#7  0x000000000041d12e in std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_range_check (this=0x7558b0, __n=15) at /usr/include/c++/8/bits/stl_vector.h:960
#8  0x0000000000413367 in std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::at (this=0x7558b0, __n=15) at /usr/include/c++/8/bits/stl_vector.h:981
#9  0x00000000004677b5 in TPESQLProcessing::put_cursor_declarations (this=0x754e60) at ../../libgixpp/TPESQLProcessing.cpp:678
#10 0x00000000004648c4 in TPESQLProcessing::outputESQL (this=0x754e60) at ../../libgixpp/TPESQLProcessing.cpp:349
#11 0x0000000000464432 in TPESQLProcessing::run (this=0x754e60, prev_step=0x0) at ../../libgixpp/TPESQLProcessing.cpp:291
#12 0x000000000045f072 in GixPreProcessor::transform (this=0x7fffffffbf50) at ../../libgixpp/GixPreProcessor.cpp:138
#13 0x000000000045ee88 in GixPreProcessor::process (this=0x7fffffffbf50) at ../../libgixpp/GixPreProcessor.cpp:129
#14 0x000000000040be02 in main (argc=8, argv=0x7fffffffc898) at ../../gixpp/main.cpp:212

some debug output:

(gdb) p stmt->sql_query_list_id
$1 = 16
(gdb) p  this->ws_query_list.size()
$2 = 15
(gdb) p this->ws_query_list.at(14).c_str()
$3 = 0x7a1530 "SELECT COUNT( * )"

The source is quite big, so what can I provide to ease inspecting this issue?

mridoni commented 1 year ago

I will check the code and try (at least and for the moment) to make it terminate "gently" in case there is a mismatch like the one you mentioned above. A minimal test case would of course be appreciated, but I'l keep investigating as soon as I have some more time.

Thanks

GitMensch commented 1 year ago

Rechecked: same error with 1.0.20b, but "obviously" a different stack trace

#6  0x00007ffff7ad106b in std::__throw_out_of_range_fmt(char const*, ...) [clone .cold.5] () from /usr/lib64/libstdc++.so.6
#7  0x000000000041d6ec in std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_range_check (this=0x760b30, __n=15)
    at /usr/include/c++/8/bits/stl_vector.h:960
#8  0x0000000000413715 in std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::at (this=0x760b30, __n=15)
    at /usr/include/c++/8/bits/stl_vector.h:981
#9  0x0000000000439887 in TPESQLProcessor::put_cursor_declarations (this=0x760910) at ../../libgixpp/TPESQLProcessor.cpp:558
#10 0x00000000004368ce in TPESQLProcessor::outputESQL (this=0x760910) at ../../libgixpp/TPESQLProcessor.cpp:228
#11 0x0000000000435f4d in TPESQLProcessor::run (this=0x760910, prev_step=std::shared_ptr<ITransformationStep> (use count 3, weak count 0) = {...}) at ../../libgixpp/TPESQLProcessor.cpp:159
#12 0x000000000042ffc7 in GixPreProcessor::transform (this=0x7fffffffbec0) at ../../libgixpp/GixPreProcessor.cpp:159
#13 0x000000000042fc5d in GixPreProcessor::process (this=0x7fffffffbec0) at ../../libgixpp/GixPreProcessor.cpp:146
#14 0x000000000040c00a in main (argc=8, argv=0x7fffffffc8a8) at ../../gixpp/main.cpp:217

and also rechecked: no error with 1.0.19.

GitMensch commented 1 year ago

👋 friendly ping for an update.