If for any reason you put an incorrect value in a column that isn't of the same type, dqlite will core dump.
Core dumps are currently non-recoverable, so this is extremely problematic.
The offending lines:
|
static int value_type(sqlite3_stmt *stmt, int i) |
|
{ |
|
int type = sqlite3_column_type(stmt, i); |
|
const char *column_type_name = sqlite3_column_decltype(stmt, i); |
|
if (column_type_name != NULL) { |
|
if ((strcasecmp(column_type_name, "DATETIME") == 0) || |
|
(strcasecmp(column_type_name, "DATE") == 0) || |
|
(strcasecmp(column_type_name, "TIMESTAMP") == 0)) { |
|
if (type == SQLITE_INTEGER) { |
|
type = DQLITE_UNIXTIME; |
|
} else { |
|
assert(type == SQLITE_TEXT || |
|
type == SQLITE_NULL); |
|
type = DQLITE_ISO8601; |
|
} |
|
} else if (strcasecmp(column_type_name, "BOOLEAN") == 0) { |
|
assert(type == SQLITE_INTEGER || type == SQLITE_NULL); |
|
type = DQLITE_BOOLEAN; |
|
} |
|
} |
|
|
|
assert(type < 16); |
|
return type; |
|
} |
In sqlite this will return the type regardless of the value. I think dqlite should follow what sqlite does here.
Note: if we compile in release mode, it prevents us from identifying other problems/issues.
If for any reason you put an incorrect value in a column that isn't of the same type, dqlite will core dump.
Core dumps are currently non-recoverable, so this is extremely problematic.
The offending lines:
dqlite/src/query.c
Lines 7 to 30 in 7a37bdf
In sqlite this will return the type regardless of the value. I think dqlite should follow what sqlite does here.
Note: if we compile in release mode, it prevents us from identifying other problems/issues.