diff options
author | drh <> | 2024-10-24 15:36:29 +0000 |
---|---|---|
committer | drh <> | 2024-10-24 15:36:29 +0000 |
commit | 4f237f8defe2c2031717835396f6b3f2017b8294 (patch) | |
tree | 81d963dcbc79d99161fe8b41ae95a3c463e25ddd /src | |
parent | ae07b98a3c992c4bc0621ce76d474714991cfa39 (diff) | |
download | sqlite-4f237f8defe2c2031717835396f6b3f2017b8294.tar.gz sqlite-4f237f8defe2c2031717835396f6b3f2017b8294.zip |
Fix harmless compiler warnings. One of the warnings was code that
deliberately committed memory errors to test the systems ability to cope.
But compilers don't allow that any more, so we'll have to leave that
capability untested.
FossilOrigin-Name: 7e7b3b2edbb580c9ac14f21e5caa8f2f6b171d9a7ce6cb336dc0c8db76da7e8c
Diffstat (limited to 'src')
-rw-r--r-- | src/test1.c | 61 |
1 files changed, 1 insertions, 60 deletions
diff --git a/src/test1.c b/src/test1.c index 5af066c6b..5d0566747 100644 --- a/src/test1.c +++ b/src/test1.c @@ -5023,8 +5023,8 @@ static int SQLITE_TCLAPI test_prepare_v3( } pzTail = objc>=6 ? &zTail : 0; rc = sqlite3_prepare_v3(db, zCopy, bytes, (unsigned int)flags,&pStmt,pzTail); - free(zCopy); zTail = &zSql[(zTail - zCopy)]; + free(zCopy); assert(rc==SQLITE_OK || pStmt==0); Tcl_ResetResult(interp); @@ -8451,64 +8451,6 @@ static int SQLITE_TCLAPI test_user_delete( #endif /* SQLITE_USER_AUTHENTICATION */ /* -** tclcmd: bad_behavior TYPE -** -** Do some things that should trigger a valgrind or -fsanitize=undefined -** warning. This is used to verify that errors and warnings output by those -** tools are detected by the test scripts. -** -** TYPE BEHAVIOR -** 1 Overflow a signed integer -** 2 Jump based on an uninitialized variable -** 3 Read after free -** 4 Panic -*/ -static int SQLITE_TCLAPI test_bad_behavior( - ClientData clientData, /* Pointer to an integer containing zero */ - Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ - int objc, /* Number of arguments */ - Tcl_Obj *CONST objv[] /* Command arguments */ -){ - int iType; - int xyz; - int i = *(int*)clientData; - int j; - int w[10]; - int *a; - if( objc!=2 ){ - Tcl_WrongNumArgs(interp, 1, objv, "TYPE"); - return TCL_ERROR; - } - if( Tcl_GetIntFromObj(interp, objv[1], &iType) ) return TCL_ERROR; - switch( iType ){ - case 1: { - xyz = 0x7fffff00 - i; - xyz += 0x100; - Tcl_SetObjResult(interp, Tcl_NewIntObj(xyz)); - break; - } - case 2: { - w[1] = 5; - if( w[i]>0 ) w[1]++; - Tcl_SetObjResult(interp, Tcl_NewIntObj(w[1])); - break; - } - case 3: { - a = malloc( sizeof(int)*10 ); - for(j=0; j<10; j++) a[j] = j; - free(a); - Tcl_SetObjResult(interp, Tcl_NewIntObj(a[i])); - break; - } - case 4: { - Tcl_Panic("Deliberate panic"); - break; - } - } - return TCL_OK; -} - -/* ** tclcmd: register_dbstat_vtab DB ** ** Cause the dbstat virtual table to be available on the connection DB @@ -9034,7 +8976,6 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ } aObjCmd[] = { { "sqlite3_db_config", test_sqlite3_db_config, 0 }, { "sqlite3_txn_state", test_sqlite3_txn_state, 0 }, - { "bad_behavior", test_bad_behavior, (void*)&iZero }, { "register_dbstat_vtab", test_register_dbstat_vtab }, { "sqlite3_connection_pointer", get_sqlite_pointer, 0 }, { "intarray_addr", test_intarray_addr, 0 }, |