Skip to content

Big INSERTs with unescaped parts cause SIGABRT #42

@oxff

Description

@oxff

The following code triggers the bug:

var insert_values = new Array({ value: '@someid', escape: false },
  someval,
  anotherval
);
db.query().insert('table', ['`fkey_ids`', '`col1`', '`col2`'],
   new Array(insert_values, ...)).execute();

I believe the bug is due to node_db::Query::placeholders miscalulating the delta. It only occurs when INSERTing lots of rows.

terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::replace

Program received signal SIGABRT, Aborted.
0x00007ffff62cc165 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00007ffff62cc165 in raise () from /lib/libc.so.6
#1  0x00007ffff62cef70 in abort () from /lib/libc.so.6
#2  0x00007ffff6d7bdc5 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
#3  0x00007ffff6d7a166 in ?? () from /usr/lib/libstdc++.so.6
#4  0x00007ffff6d7a193 in std::terminate() () from /usr/lib/libstdc++.so.6
#5  0x00007ffff6d7a1a6 in ?? () from /usr/lib/libstdc++.so.6
#6  0x00007ffff6d797e3 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.6
#7  0x00007ffff588461b in node_db::Query::parseQuery (this=0xfb8ca0) at ../lib/node-db/query.cc:1378
#8  0x00007ffff587d2f8 in node_db::Query::Execute (args=...) at ../lib/node-db/query.cc:599
#9  0x00000000005a96b1 in v8::internal::Builtin_HandleApiCall(v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>, v8::internal::Isolate*) ()
#10 0x00002d40ce48814e in ?? ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions