Skip to content
Snippets Groups Projects
Commit d37849a4 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Merge branch 'patches/bug10035' into 8.0

* patches/bug10035:
  SQLite.ResObj: Survive sqlite3_column_name() returning NULL.
parents e5ee05ca 88821b39
No related branches found
No related tags found
No related merge requests found
...@@ -229,6 +229,16 @@ PIKECLASS ResObj ...@@ -229,6 +229,16 @@ PIKECLASS ResObj
*/ */
PIKEFUN array(mapping(string:mixed)) fetch_fields() { PIKEFUN array(mapping(string:mixed)) fetch_fields() {
int i,t; int i,t;
if (!sqlite3_column_name(THIS->stmt, 0)) {
/* Documented to happen on malloc() failure,
* but can apparently happen in other cases too.
* The common case seems to be when called after
* the last row has been fetched.
* Cf #10035.
*/
push_int(0);
return;
}
for(i=0; i<THIS->columns; i++) { for(i=0; i<THIS->columns; i++) {
push_constant_text("name"); push_constant_text("name");
push_text(sqlite3_column_name(THIS->stmt, i)); push_text(sqlite3_column_name(THIS->stmt, i));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment