SQLite Forum

IS NULL optimization on NOT NULL constraints breaks on corrupted databases
> The issue here was that GDAL segfaulted when opening that database because of the null dereference of a corrupted record. 

Did SQLite segfault?  If so that would be a bug that we need to look into.

Or, did GDAL do an sqlite3_column_text() and get back a NULL pointer, then
dereference the NULL pointer, thus causing a segfault.  That would be a bug
in GDAL.  The sqlite3_column_text() might return NULL, even for a NOT NULL
column, for example following an OOM error.  That's part of the specification
of how sqlite3_column_text() works.  If you were not checking for a NULL return
from sqlite3_column_text() and it always worked before, that is because you
were lucky.  It would be to same if you failed to check for a NULL return
from malloc().