When running the SQLite unit-tests on Cygwin64
(but the same is expected to happen on any
64-bit UNIX-like system):

$ .libs/testfixture.exe test/tclsqlite.test
tcl-1.1... Ok
tcl-1.2... Ok
tcl-1.2.1...Segmentation fault (core dumped)

The cause of this crash is the Tcl function
Tcl_AppendResult(), which expects a 64-bit
NULL-pointer as last argument. But tclsqlite.c
uses 0 here, which is a 32-bit integer. The
compiler cannot know this, because the function
has a variable number of arguments.

Below's patch fixes this specific unit-test failure.
Many other Tcl_AppendResult() calls make the same
mistake, but in many other places it is done correctly.

The change from Tcl_GetStringFromObj() to
Tcl_GetString() is just meant to shorten the
line length: since the second argument is 0,
those are equivalent.

Regards,
       Jan Nijtmans

--- src/tclsqlite.c
+++ src/tclsqlite.c
@@ -1835,11 +1835,11 @@
           pDb->maxStmt = n;
         }
       }
     }else{
       Tcl_AppendResult( interp, "bad option \"",
-          Tcl_GetStringFromObj(objv[2],0), "\": must be flush or size", 0);
+          Tcl_GetString(objv[2]), "\": must be flush or size", (char *)0);
       return TCL_ERROR;
     }
     break;
   }
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to