There are a couple more cases of Tcl_AppendResults( ..., 0) in tclsqlite.c

Unfortunately, Tcl_AppendResults() is defined as having varargs and thus 
lacking type checking.

I would prefer NULL over (char*)0 anyway, which BTW is also present at least 
once in tclsqlite.c

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Jan Nijtmans
Gesendet: Donnerstag, 12. Jänner 2017 10:43
An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
Betreff: [sqlite] tclsqlite 64-bit bug [Was: extension to run bash]

2017-01-12 3:04 GMT+01:00 Warren Young:
> In fact, one improvement made to SQLite a few years ago was to switch
> it from using native Windows file locking when built under Cygwin to
> use POSIX or BSD locking mechanisms, so that two programs built under
> Cygwin that both used SQLite would get the advisory locking semantics
> they expect, not the mandatory locking semantics Windows gives you by
> default.  (It’s more complicated than that, but I don’t want to go
> deeper into it here.)

Yeah ...  I'm slowly trying to submit all portability issues I discover back to 
the SQLite developers, so far with little success.

For example, the following patch fixes possible crashes in error-handling in 
64-bit builds (not Cygwin-specific). Explanation:
On 64-bit builds '0' is a 32-bit integer, but Tcl_AppendResult() expects a 
NULL-pointer as last element which is 64-bit.

Any chance for this to be in the next SQLite release?

Thanks!
        Jan Nijtmans
=======================================
$ fossil diff
Index: src/tclsqlite.c
==================================================================
--- src/tclsqlite.c
+++ src/tclsqlite.c
@@ -2534,11 +2534,11 @@
     for(i=3; i<(objc-1); i++){
       const char *z = Tcl_GetString(objv[i]);
       int n = strlen30(z);
       if( n>2 && strncmp(z, "-argcount",n)==0 ){
         if( i==(objc-2) ){
-          Tcl_AppendResult(interp, "option requires an argument: ", z, 0);
+          Tcl_AppendResult(interp, "option requires an argument: ",
z, (char *)0);
           return TCL_ERROR;
         }
         if( Tcl_GetIntFromObj(interp, objv[i+1], &nArg) ) return TCL_ERROR;
         if( nArg<0 ){
           Tcl_AppendResult(interp, "number of arguments must be non-negative", 
@@ -2549,11 +2549,11 @@
       }else
       if( n>2 && strncmp(z, "-deterministic",n)==0 ){
         flags |= SQLITE_DETERMINISTIC;
       }else{
         Tcl_AppendResult(interp, "bad option \"", z,
-            "\": must be -argcount or -deterministic", 0
+            "\": must be -argcount or -deterministic", (char *)0
         );
         return TCL_ERROR;
       }
     }

@@ -3206,11 +3206,11 @@
         if( rc==SQLITE_OK ){
           Tcl_Obj *pObj;
           pObj = Tcl_NewStringObj((char*)sqlite3_value_text(pValue), -1);
           Tcl_SetObjResult(interp, pObj);
         }else{
-          Tcl_AppendResult(interp, sqlite3_errmsg(pDb->db), 0);
+          Tcl_AppendResult(interp, sqlite3_errmsg(pDb->db), (char *)0);
           return TCL_ERROR;
         }
       }
     }
 #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ 
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to