Hi,
Since the last mail I sent was not really readable due to problems with
my mail settings I resend the possible bug report below.
I want to report a (possible) bug in sqlite3. When
sqlite3_clear_bindings is called with a nullptr argument, then a
SEGFAULT occurs.
From the behavior of the other methods which use statement as a
parameter I expected the behaviour that sqlite3_clear_bindings with a
nullptr argument is a no-op, since all of sqlite3_bind_*, sqlite3_step,
sqlite3_reset and sqlite3_finalize (that's the ones I checked) don't crash.
Please have a look at the example below.
#include <iostream>
#include "sqlite3.h"
sqlite3* db;
int main()
{
// DB Setup
sqlite3_open(":memory:", &db);
sqlite3_exec(db, "CREATE TABLE test (id INTEGER PRIMARY KEY);",
nullptr, nullptr, nullptr);
// Working example
sqlite3_stmt* workingStatement;
sqlite3_prepare(db, "SELECT * from test where id = ?", -1,
&workingStatement, nullptr);
sqlite3_bind_int(workingStatement, 0, 0);
sqlite3_step(workingStatement);
sqlite3_clear_bindings(workingStatement);
sqlite3_reset(workingStatement);
sqlite3_finalize(workingStatement);
// Crashing example. The Statement can't be created because of the
nonexisting table.
sqlite3_stmt* nonWorkingStatement;
sqlite3_prepare(db, "SELECT * from nonexisting where id = ?", -1,
&nonWorkingStatement, nullptr);
sqlite3_bind_int(nonWorkingStatement, 0, 0);
sqlite3_step(nonWorkingStatement);
sqlite3_clear_bindings(nonWorkingStatement); // SEGFAULT
sqlite3_reset(nonWorkingStatement);
sqlite3_finalize(nonWorkingStatement);
}
Thanks for your great work!
Best regards
Christof Arnosti
---------------------------------------------------------------------------------------------------------
This e-mail is confidential and may contain privileged information. It is
intended only for the addressees. If you have received this e-mail in error,
kindly notify us immediately by telephone or e-mail and delete the message from
your system.
---------------------------------------------------------------------------------------------------------
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users