Task #168 - sqlite-3.45.2-1.fc41/scan-results.err
back to task #168download
Error: COMPILER_WARNING (CWE-1164): sqlite-src-3450200/sqlite3_analyzer.c:183544:21: warning[-Wunused-function]: 'sqlite3ConnectionBlocked' defined but not used #183544 | SQLITE_PRIVATE void sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){ # | ^~~~~~~~~~~~~~~~~~~~~~~~ #183542| ** until connection pBlocker concludes its current transaction. #183543| */ #183544|-> SQLITE_PRIVATE void sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){ #183545| enterMutex(); #183546| if( db->pBlockingConnection==0 && db->pUnlockConnection==0 ){ Error: CPPCHECK_WARNING (CWE-401): sqlite-src-3450200/src/tclsqlite.c:1220: error[memleakOnRealloc]: Common realloc mistake: 'zLine' nulled but not freed upon failure # 1218| if( n+100>nLine ){ # 1219| nLine = nLine*2 + 100; # 1220|-> zLine = realloc(zLine, nLine); # 1221| if( zLine==0 ) return 0; # 1222| } Error: CLANG_WARNING: sqlite-src-3450200/src/tclsqlite.c:1221:29: warning[unix.Malloc]: Potential leak of memory pointed to by 'zLine' # 1219| nLine = nLine*2 + 100; # 1220| zLine = realloc(zLine, nLine); # 1221|-> if( zLine==0 ) return 0; # 1222| } # 1223| if( fgets(&zLine[n], nLine - n, in)==0 ){ Error: CPPCHECK_WARNING (CWE-401): sqlite-src-3450200/src/tclsqlite.c:1238: error[memleakOnRealloc]: Common realloc mistake: 'zLine' nulled but not freed upon failure # 1236| } # 1237| } # 1238|-> zLine = realloc( zLine, n+1 ); # 1239| return zLine; # 1240| } Error: CLANG_WARNING: sqlite-src-3450200/src/tclsqlite.c:1548:28: warning[core.NullDereference]: Access to field 'pNext' results in a dereference of a null pointer (loaded from field 'stmtLast') # 1546| SqlPreparedStmt *pLast = pDb->stmtLast; # 1547| pDb->stmtLast = pLast->pPrev; # 1548|-> pDb->stmtLast->pNext = 0; # 1549| pDb->nStmt--; # 1550| dbFreeStmt(pLast); Error: GCC_ANALYZER_WARNING (CWE-476): sqlite-src-3450200/src/tclsqlite.c: scope_hint: In function ‘DbHookCmd’ sqlite-src-3450200/src/tclsqlite.c:1914:7: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ppHook’ /usr/include/tcl.h:2421: included_from: Included from here. sqlite-src-3450200/src/tclsqlite.c:41: included_from: Included from here. # 1912| sqlite3 *db = pDb->db; # 1913| # 1914|-> if( *ppHook ){ # 1915| Tcl_SetObjResult(interp, *ppHook); # 1916| if( pArg ){ Error: CLANG_WARNING: sqlite-src-3450200/src/tclsqlite.c:2621:5: warning[unix.Malloc]: Potential memory leak # 2619| } # 2620| } # 2621|-> free(azCol); # 2622| fclose(in); # 2623| sqlite3_finalize(pStmt); Error: GCC_ANALYZER_WARNING (CWE-686): sqlite-src-3450200/tool/lemon.c: scope_hint: In function ‘lemon_vsprintf’ sqlite-src-3450200/tool/lemon.c:112:13: warning[-Wanalyzer-va-arg-type-mismatch]: ‘va_arg’ expected ‘int’ but received ‘char *’ for variadic argument 1 of ‘ap’ # 110| } # 111| if( c=='d' ){ # 112|-> int v = va_arg(ap, int); # 113| if( v<0 ){ # 114| lemon_addtext(str, &nUsed, "-", 1, iWidth); Error: GCC_ANALYZER_WARNING (CWE-686): sqlite-src-3450200/tool/lemon.c:112:13: warning[-Wanalyzer-va-arg-type-mismatch]: ‘va_arg’ expected ‘int’ but received ‘char *’ for variadic argument 2 of ‘ap’ # 110| } # 111| if( c=='d' ){ # 112|-> int v = va_arg(ap, int); # 113| if( v<0 ){ # 114| lemon_addtext(str, &nUsed, "-", 1, iWidth); Error: GCC_ANALYZER_WARNING (CWE-686): sqlite-src-3450200/tool/lemon.c:112:13: warning[-Wanalyzer-va-arg-type-mismatch]: ‘va_arg’ expected ‘int’ but received ‘const char *’ for variadic argument 1 of ‘ap’ # 110| } # 111| if( c=='d' ){ # 112|-> int v = va_arg(ap, int); # 113| if( v<0 ){ # 114| lemon_addtext(str, &nUsed, "-", 1, iWidth); Error: GCC_ANALYZER_WARNING (CWE-686): sqlite-src-3450200/tool/lemon.c:112:13: warning[-Wanalyzer-va-arg-type-mismatch]: ‘va_arg’ expected ‘int’ but received ‘const char *’ for variadic argument 2 of ‘ap’ # 110| } # 111| if( c=='d' ){ # 112|-> int v = va_arg(ap, int); # 113| if( v<0 ){ # 114| lemon_addtext(str, &nUsed, "-", 1, iWidth); Error: GCC_ANALYZER_WARNING (CWE-686): sqlite-src-3450200/tool/lemon.c:127:11: warning[-Wanalyzer-va-arg-type-mismatch]: ‘va_arg’ expected ‘const char *’ but received ‘int’ for variadic argument 1 of ‘ap’ # 125| lemon_addtext(str, &nUsed, &zTemp[sizeof(zTemp)-k], k, iWidth); # 126| }else if( c=='s' ){ # 127|-> z = va_arg(ap, const char*); # 128| lemon_addtext(str, &nUsed, z, -1, iWidth); # 129| }else if( c=='.' && memcmp(&zFormat[i], ".*s", 3)==0 ){ Error: GCC_ANALYZER_WARNING (CWE-686): sqlite-src-3450200/tool/lemon.c:131:11: warning[-Wanalyzer-va-arg-type-mismatch]: ‘va_arg’ expected ‘int’ but received ‘char *’ for variadic argument 1 of ‘ap’ # 129| }else if( c=='.' && memcmp(&zFormat[i], ".*s", 3)==0 ){ # 130| i += 2; # 131|-> k = va_arg(ap, int); # 132| z = va_arg(ap, const char*); # 133| lemon_addtext(str, &nUsed, z, k, iWidth); Error: GCC_ANALYZER_WARNING (CWE-686): sqlite-src-3450200/tool/lemon.c:131:11: warning[-Wanalyzer-va-arg-type-mismatch]: ‘va_arg’ expected ‘int’ but received ‘char *’ for variadic argument 2 of ‘ap’ # 129| }else if( c=='.' && memcmp(&zFormat[i], ".*s", 3)==0 ){ # 130| i += 2; # 131|-> k = va_arg(ap, int); # 132| z = va_arg(ap, const char*); # 133| lemon_addtext(str, &nUsed, z, k, iWidth); Error: GCC_ANALYZER_WARNING (CWE-686): sqlite-src-3450200/tool/lemon.c:131:11: warning[-Wanalyzer-va-arg-type-mismatch]: ‘va_arg’ expected ‘int’ but received ‘const char *’ for variadic argument 1 of ‘ap’ # 129| }else if( c=='.' && memcmp(&zFormat[i], ".*s", 3)==0 ){ # 130| i += 2; # 131|-> k = va_arg(ap, int); # 132| z = va_arg(ap, const char*); # 133| lemon_addtext(str, &nUsed, z, k, iWidth); Error: GCC_ANALYZER_WARNING (CWE-686): sqlite-src-3450200/tool/lemon.c:131:11: warning[-Wanalyzer-va-arg-type-mismatch]: ‘va_arg’ expected ‘int’ but received ‘const char *’ for variadic argument 2 of ‘ap’ # 129| }else if( c=='.' && memcmp(&zFormat[i], ".*s", 3)==0 ){ # 130| i += 2; # 131|-> k = va_arg(ap, int); # 132| z = va_arg(ap, const char*); # 133| lemon_addtext(str, &nUsed, z, k, iWidth); Error: CLANG_WARNING: sqlite-src-3450200/tool/lemon.c:713:9: warning[core.NullDereference]: Dereference of null pointer # 711| end = makeItSafe ? p->mnLookahead : 0; # 712| for(i=p->nAction-1; i>=end; i--){ # 713|-> if( p->aAction[i].lookahead==p->mnLookahead ){ # 714| /* All lookaheads and actions in the aLookahead[] transaction # 715| ** must match against the candidate aAction[i] entry. */ Error: CLANG_WARNING: sqlite-src-3450200/tool/lemon.c:749:11: warning[core.NullDereference]: Dereference of null pointer # 747| i = makeItSafe ? p->mnLookahead : 0; # 748| for(; i<p->nActionAlloc - p->mxLookahead; i++){ # 749|-> if( p->aAction[i].lookahead<0 ){ # 750| for(j=0; j<p->nLookahead; j++){ # 751| k = p->aLookahead[j].lookahead - p->mnLookahead + i; Error: CLANG_WARNING: sqlite-src-3450200/tool/lemon.c:775:19: warning[core.NullDereference]: Array access (via field 'aAction') results in a null pointer dereference # 773| for(j=0; j<p->nLookahead; j++){ # 774| k = p->aLookahead[j].lookahead - p->mnLookahead + i; # 775|-> p->aAction[k] = p->aLookahead[j]; # 776| if( k>=p->nAction ) p->nAction = k+1; # 777| } Error: CLANG_WARNING: sqlite-src-3450200/tool/lemon.c:917:39: warning[core.NullDereference]: Access to field 'lhs' results in a dereference of a null pointer (loaded from field 'startRule') # 915| "The specified start symbol \"%s\" is not " # 916| "in a nonterminal of the grammar. \"%s\" will be used as the start " # 917|-> "symbol instead.",lemp->start,lemp->startRule->lhs->name); # 918| lemp->errorcnt++; # 919| sp = lemp->startRule->lhs; Error: CLANG_WARNING: sqlite-src-3450200/tool/lemon.c:958:3: warning[unix.Malloc]: Potential memory leak # 956| ** The returned pointer to the first state is not used. */ # 957| (void)getstate(lemp); # 958|-> return; # 959| } # 960| Error: GCC_ANALYZER_WARNING (CWE-476): sqlite-src-3450200/tool/lemon.c: scope_hint: In function ‘Configlist_add.part.0’ sqlite-src-3450200/tool/lemon.c:1358:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(1, 72)’ sqlite-src-3450200/tool/lemon.c: scope_hint: In function ‘Configlist_add.part.0’ # 1356| if( cfp==0 ){ # 1357| cfp = newconfig(); # 1358|-> cfp->rp = rp; # 1359| cfp->dot = dot; # 1360| cfp->fws = SetNew(); Error: GCC_ANALYZER_WARNING (CWE-688): sqlite-src-3450200/tool/lemon.c: scope_hint: In function ‘OptInit.part.0’ sqlite-src-3450200/tool/lemon.c:2126:5: warning[-Wanalyzer-null-argument]: use of NULL ‘err’ where non-null expected sqlite-src-3450200/tool/lemon.c:14: included_from: Included from here. sqlite-src-3450200/tool/lemon.c:9: included_from: Included from here. /usr/include/stdio.h:357:12: note: argument 1 of ‘fprintf’ must be non-null # 2124| } # 2125| if( errcnt>0 ){ # 2126|-> fprintf(err,"Valid command line options for \"%s\" are:\n",*a); # 2127| OptPrint(); # 2128| exit(1); Error: GCC_ANALYZER_WARNING (CWE-775): sqlite-src-3450200/tool/lemon.c: scope_hint: In function ‘ReportTable’ sqlite-src-3450200/tool/lemon.c:3233:11: warning[-Wanalyzer-file-leak]: leak of FILE ‘file_open(lemp, ".sql", "wb")’ sqlite-src-3450200/tool/lemon.c: scope_hint: In function ‘ReportTable’ # 3231| FILE *fp; # 3232| # 3233|-> if( lemp->outname ) free(lemp->outname); # 3234| lemp->outname = file_makename(lemp, suffix); # 3235| fp = fopen(lemp->outname,mode); Error: GCC_ANALYZER_WARNING (CWE-401): sqlite-src-3450200/tool/lemon.c:3233:11: warning[-Wanalyzer-malloc-leak]: leak of ‘file_open(lemp, ".sql", "wb")’ sqlite-src-3450200/tool/lemon.c: scope_hint: In function ‘ReportTable’ # 3231| FILE *fp; # 3232| # 3233|-> if( lemp->outname ) free(lemp->outname); # 3234| lemp->outname = file_makename(lemp, suffix); # 3235| fp = fopen(lemp->outname,mode); Error: CLANG_WARNING: sqlite-src-3450200/tool/lemon.c:3572:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'pathbuf' # 3570| } # 3571| } # 3572|-> free(pathbufptr); # 3573| } # 3574| return path; Error: GCC_ANALYZER_WARNING (CWE-775): sqlite-src-3450200/tool/lemon.c:3662:25: warning[-Wanalyzer-file-leak]: leak of FILE ‘tplt_open(lemp)’ sqlite-src-3450200/tool/lemon.c: scope_hint: In function ‘ReportTable’ # 3660| # 3661| /* first, see if user specified a template filename on the command line. */ # 3662|-> if (user_templatename != 0) { # 3663| if( access(user_templatename,004)==-1 ){ # 3664| fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", Error: GCC_ANALYZER_WARNING (CWE-401): sqlite-src-3450200/tool/lemon.c:3662:25: warning[-Wanalyzer-malloc-leak]: leak of ‘tplt_open(lemp)’ sqlite-src-3450200/tool/lemon.c: scope_hint: In function ‘ReportTable’ # 3660| # 3661| /* first, see if user specified a template filename on the command line. */ # 3662|-> if (user_templatename != 0) { # 3663| if( access(user_templatename,004)==-1 ){ # 3664| fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", Error: CPPCHECK_WARNING (CWE-401): sqlite-src-3450200/tool/lemon.c:3834: error[memleakOnRealloc]: Common realloc mistake: 'z' nulled but not freed upon failure # 3832| if( (int) (n+sizeof(zInt)*2+used) >= alloced ){ # 3833| alloced = n + sizeof(zInt)*2 + used + 200; # 3834|-> z = (char *) realloc(z, alloced); # 3835| } # 3836| if( z==0 ) return empty; Error: GCC_ANALYZER_WARNING (CWE-476): sqlite-src-3450200/tool/lemon.c:12: included_from: Included from here. sqlite-src-3450200/tool/lemon.c: scope_hint: In function ‘Symbol_new’ sqlite-src-3450200/tool/lemon.c:5412:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘x’ sqlite-src-3450200/tool/lemon.c:5412:16: note: in expansion of macro ‘ISUPPER’ sqlite-src-3450200/tool/lemon.c:5410:5: note: in expansion of macro ‘MemoryCheck’ sqlite-src-3450200/tool/lemon.c:5412:16: note: in expansion of macro ‘ISUPPER’ # 5410| MemoryCheck(sp); # 5411| sp->name = Strsafe(x); # 5412|-> sp->type = ISUPPER(*x) ? TERMINAL : NONTERMINAL; # 5413| sp->rule = 0; # 5414| sp->fallback = 0; Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:288:3: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 286| az = sqlite3_malloc( sizeof(char*)*(nPK+1) ); # 287| if( az==0 ) runtimeError("out of memory"); # 288|-> memset(az, 0, sizeof(char*)*(nPK+1)); # 289| if( g.bSchemaCompare ){ # 290| az[0] = sqlite3_mprintf("%s", "type"); Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:305:19: warning[core.NullDereference]: Array access (from variable 'az') results in a null pointer dereference # 303| az = sqlite3_realloc(az, sizeof(char*)*(naz+2) ); # 304| if( az==0 ) runtimeError("out of memory"); # 305|-> az[naz++] = sid; # 306| } # 307| } Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:1103:9: warning[deadcode.DeadStores]: Value stored to 'bestCnt' is never read # 1101| lastRead = bestOfst + bestCnt - 1; # 1102| } # 1103|-> bestCnt = 0; # 1104| break; # 1105| } Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:1260:15: warning[core.NullDereference]: Array access (from variable 'azCol') results in a null pointer dereference # 1258| runtimeError("table %s has no usable PK columns", zTab); # 1259| } # 1260|-> for(nCol=0; azCol[nCol]; nCol++); # 1261| # 1262| /* Build and output the CREATE TABLE statement for the data_xxx table */ Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:1583:19: warning[core.NullDereference]: Array access (from variable 'azCol') results in a null pointer dereference # 1581| aiFlg = sqlite3_realloc(aiFlg, sizeof(int)*nCol); # 1582| if( aiFlg==0 ) runtimeError("out of memory"); # 1583|-> azCol[nCol-1] = safeId((const char*)sqlite3_column_text(pStmt,1)); # 1584| aiFlg[nCol-1] = i = sqlite3_column_int(pStmt,5); # 1585| if( i>0 ){ Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:1584:19: warning[core.NullDereference]: Array access (from variable 'aiFlg') results in a null pointer dereference # 1582| if( aiFlg==0 ) runtimeError("out of memory"); # 1583| azCol[nCol-1] = safeId((const char*)sqlite3_column_text(pStmt,1)); # 1584|-> aiFlg[nCol-1] = i = sqlite3_column_int(pStmt,5); # 1585| if( i>0 ){ # 1586| if( i>nPk ){ Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:1591:17: warning[core.NullDereference]: Array access (from variable 'aiPk') results in a null pointer dereference # 1589| if( aiPk==0 ) runtimeError("out of memory"); # 1590| } # 1591|-> aiPk[i-1] = nCol-1; # 1592| } # 1593| } Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:1824:3: warning[deadcode.DeadStores]: Value stored to 'zSql' is never read # 1822| zSql = gobble_token(zSql, zToken, sizeof(zToken)); # 1823| if( zSql==0 || sqlite3_stricmp(zToken, "using") ) return; # 1824|-> zSql = gobble_token(zSql, zToken, sizeof(zToken)); # 1825| # 1826| sqlite3_result_text(pCtx, zToken, -1, SQLITE_TRANSIENT); Error: COMPILER_WARNING (CWE-563): sqlite-src-3450200/tool/sqldiff.c: scope_hint: In function 'all_tables_sql' sqlite-src-3450200/tool/sqldiff.c:1835:9: warning[-Wunused-but-set-variable]: variable 'rc' set but not used # 1835 | int rc; # | ^~ # 1833| const char *all_tables_sql(){ # 1834| if( g.bHandleVtab ){ # 1835|-> int rc; # 1836| # 1837| rc = sqlite3_exec(g.db, Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:1837:5: warning[deadcode.DeadStores]: Value stored to 'rc' is never read # 1835| int rc; # 1836| # 1837|-> rc = sqlite3_exec(g.db, # 1838| "CREATE TEMP TABLE tblmap(module COLLATE nocase, postfix);" # 1839| "INSERT INTO temp.tblmap VALUES" Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:1853:5: warning[deadcode.DeadStores]: Value stored to 'rc' is never read # 1851| assert( rc==SQLITE_OK ); # 1852| # 1853|-> rc = sqlite3_create_function( # 1854| g.db, "module_name", 1, SQLITE_UTF8, 0, module_name_func, 0, 0 # 1855| ); Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:1948:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'azExt' # 1946| }else # 1947| if( strcmp(z,"help")==0 ){ # 1948|-> showHelp(); # 1949| return 0; # 1950| }else Error: CLANG_WARNING: sqlite-src-3450200/tool/sqldiff.c:1956:23: warning[core.NullDereference]: Array access (from variable 'azExt') results in a null pointer dereference # 1954| azExt = realloc(azExt, sizeof(azExt[0])*(nExt+1)); # 1955| if( azExt==0 ) cmdlineError("out of memory"); # 1956|-> azExt[nExt++] = argv[++i]; # 1957| }else # 1958| #endif Error: CPPCHECK_WARNING (CWE-476): sqlite-src-3450200/tool/src-verify.c:863: warning[nullPointer]: Possible null pointer dereference: zDir # 861| return 1; # 862| } # 863|-> if( strlen(zDir)>1000 ){ # 864| fprintf(stderr, "Directory argument too big: [%s]\n", zDir); # 865| return 1; Error: GCC_ANALYZER_WARNING (CWE-688): sqlite-src-3450200/tool/src-verify.c: scope_hint: In function ‘main’ sqlite-src-3450200/tool/src-verify.c:863:7: warning[-Wanalyzer-null-argument]: use of NULL ‘zDir’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null # 861| return 1; # 862| } # 863|-> if( strlen(zDir)>1000 ){ # 864| fprintf(stderr, "Directory argument too big: [%s]\n", zDir); # 865| return 1; Error: CLANG_WARNING: sqlite-src-3450200/tool/src-verify.c:863:7: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 861| return 1; # 862| } # 863|-> if( strlen(zDir)>1000 ){ # 864| fprintf(stderr, "Directory argument too big: [%s]\n", zDir); # 865| return 1;