/ Check-in [c07caabf]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change tclsqlite3.c so that it never invokes ctype macros with signed character arguments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c07caabf2396c84b2ccb0e9f98ae6279ce41c59d
User & Date: drh 2013-11-26 16:48:04
Context
2013-11-26
16:51
Fix a possible NULL pointer deference in the wordcount test program. check-in: 6f91dca0 user: drh tags: trunk
16:48
Change tclsqlite3.c so that it never invokes ctype macros with signed character arguments. check-in: c07caabf user: drh tags: trunk
16:20
Do not try to run the atof1.test test script on ARM hardware which lacks the "long double" type. check-in: fafca560 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/tclsqlite.c.

   420    420   /*
   421    421   ** Find an SqlFunc structure with the given name.  Or create a new
   422    422   ** one if an existing one cannot be found.  Return a pointer to the
   423    423   ** structure.
   424    424   */
   425    425   static SqlFunc *findSqlFunc(SqliteDb *pDb, const char *zName){
   426    426     SqlFunc *p, *pNew;
   427         -  int i;
   428         -  pNew = (SqlFunc*)Tcl_Alloc( sizeof(*pNew) + strlen30(zName) + 1 );
          427  +  int nName = strlen30(zName);
          428  +  pNew = (SqlFunc*)Tcl_Alloc( sizeof(*pNew) + nName + 1 );
   429    429     pNew->zName = (char*)&pNew[1];
   430         -  for(i=0; zName[i]; i++){ pNew->zName[i] = tolower(zName[i]); }
   431         -  pNew->zName[i] = 0;
          430  +  memcpy(pNew->zName, zName, nName+1);
   432    431     for(p=pDb->pFunc; p; p=p->pNext){ 
   433         -    if( strcmp(p->zName, pNew->zName)==0 ){
          432  +    if( sqlite3_stricmp(p->zName, pNew->zName)==0 ){
   434    433         Tcl_Free((char*)pNew);
   435    434         return p;
   436    435       }
   437    436     }
   438    437     pNew->interp = pDb->interp;
   439    438     pNew->pDb = pDb;
   440    439     pNew->pScript = 0;
................................................................................
  1079   1078   ){
  1080   1079     const char *zSql = zIn;         /* Pointer to first SQL statement in zIn */
  1081   1080     sqlite3_stmt *pStmt;            /* Prepared statement object */
  1082   1081     SqlPreparedStmt *pPreStmt;      /* Pointer to cached statement */
  1083   1082     int nSql;                       /* Length of zSql in bytes */
  1084   1083     int nVar;                       /* Number of variables in statement */
  1085   1084     int iParm = 0;                  /* Next free entry in apParm */
         1085  +  char c;
  1086   1086     int i;
  1087   1087     Tcl_Interp *interp = pDb->interp;
  1088   1088   
  1089   1089     *ppPreStmt = 0;
  1090   1090   
  1091   1091     /* Trim spaces from the start of zSql and calculate the remaining length. */
  1092         -  while( isspace(zSql[0]) ){ zSql++; }
         1092  +  while( (c = zSql[0])==' ' || c=='\t' || c=='\r' || c=='\n' ){ zSql++; }
  1093   1093     nSql = strlen30(zSql);
  1094   1094   
  1095   1095     for(pPreStmt = pDb->stmtList; pPreStmt; pPreStmt=pPreStmt->pNext){
  1096   1096       int n = pPreStmt->nSql;
  1097   1097       if( nSql>=n 
  1098   1098           && memcmp(pPreStmt->zSql, zSql, n)==0
  1099   1099           && (zSql[n]==0 || zSql[n-1]==';')