Fixed defects

List of Defects

Error: CPPCHECK_WARNING: [#def1]
rpm-4.19.1.1-build/rpm-4.19.1.1/build/parsePrep.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def2]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/backend/sqlite.c:460:30: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'hdrNum')
#  458|   
#  459|       /* XXX rowid is a 64bit integer and could overflow hdrnum */
#  460|->     if (rc == SQLITE_DONE && *hdrNum == 0)
#  461|   	*hdrNum = sqlite3_last_insert_rowid(dbc->sdb);
#  462|   

Error: CLANG_WARNING: [#def3]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/backend/sqlite.c:480:10: warning[deadcode.DeadStores]: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc'
#  478|   
#  479|       if (!rc)
#  480|-> 	while ((rc = sqlite3_step(dbc->stmt)) == SQLITE_ROW) {};
#  481|   
#  482|       return dbiCursorResult(dbc);

Error: CLANG_WARNING: [#def4]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/backend/sqlite.c:646:10: warning[deadcode.DeadStores]: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc'
#  644|   
#  645|       if (!rc)
#  646|-> 	while ((rc = sqlite3_step(dbc->stmt)) == SQLITE_ROW) {};
#  647|   
#  648|       return dbiCursorResult(dbc);

Error: CLANG_WARNING: [#def5]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/backend/sqlite.c:665:10: warning[deadcode.DeadStores]: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc'
#  663|   
#  664|       if (!rc)
#  665|-> 	while ((rc = sqlite3_step(dbc->stmt)) == SQLITE_ROW) {};
#  666|   
#  667|       rc = dbiCursorResult(dbc);

Error: CLANG_WARNING: [#def6]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/headerfmt.c:709:2: warning[deadcode.DeadStores]: Value stored to 't' is never read
#  707|   
#  708|       case PTOK_TAG:
#  709|-> 	t = hsa->val + hsa->vallen;
#  710|   	te = formatValue(hsa, &token->u.tag,
#  711|   			(token->u.tag.justOne ? 0 : element));

Error: CLANG_WARNING: [#def7]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/headerfmt.c:729:2: warning[deadcode.DeadStores]: Value stored to 't' is never read
#  727|   	if (spft == NULL || need == 0) break;
#  728|   
#  729|-> 	t = hsaReserve(hsa, need);
#  730|   	for (i = 0; i < condNumFormats; i++, spft++) {
#  731|   	    te = singleSprintf(hsa, spft, element);

Error: CLANG_WARNING: [#def8]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/headerfmt.c:795:6: warning[deadcode.DeadStores]: Value stored to 't' is never read
#  793|   	    }
#  794|   
#  795|-> 	    t = hsaReserve(hsa, need);
#  796|   	    for (j = 0; j < numElements; j++) {
#  797|   		spft = token->u.array.format;

Error: CLANG_WARNING: [#def9]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/rpmfi.c:329:2: warning[deadcode.DeadStores]: Value stored to 'i' is never read
#  327|       if (fi != NULL && fx >= 0 && fx < rpmfilesFC(fi->files)) {
#  328|   	int dx = fi->j;
#  329|-> 	i = fi->i;
#  330|   	fi->i = fx;
#  331|   	fi->j = rpmfilesDI(fi->files, fi->i);

Error: CLANG_WARNING: [#def10]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/rpmscript.c:444:9: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value
#  442|   	fclose(in);
#  443|   
#  444|->     if (inpipe[0])
#  445|   	close(inpipe[0]);
#  446|   

Error: GCC_ANALYZER_WARNING (CWE-457): [#def11]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/rpmscript.c:444:15: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘inpipe[0]’
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/rpmscript.c:5: included_from: Included from here.
#  442|   	fclose(in);
#  443|   
#  444|->     if (inpipe[0])
#  445|   	close(inpipe[0]);
#  446|   

Error: CLANG_WARNING: [#def12]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/rpmts.c:453:5: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value
#  451|   static void finiPgpData(struct pgpdata_s *pd)
#  452|   {
#  453|->     free(pd->timestr);
#  454|       free(pd->verid);
#  455|       free(pd->signid);

Error: CLANG_WARNING: [#def13]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/rpmts.c:663:3: warning[deadcode.DeadStores]: Value stored to 'rc' is never read
#  661|   	if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) {
#  662|   	    if (ts->keyringtype == KEYRING_FS)
#  663|-> 		rc = rpmtsImportFSKey(txn, h, 0);
#  664|   	    else
#  665|   		rc = rpmtsImportHeader(txn, h, 0);

Error: CLANG_WARNING: [#def14]
rpm-4.19.1.1-build/rpm-4.19.1.1/lib/rpmts.c:665:3: warning[deadcode.DeadStores]: Value stored to 'rc' is never read
#  663|   		rc = rpmtsImportFSKey(txn, h, 0);
#  664|   	    else
#  665|-> 		rc = rpmtsImportHeader(txn, h, 0);
#  666|   	}
#  667|       }

Error: CPPCHECK_WARNING (CWE-758): [#def15]
rpm-4.19.1.1-build/rpm-4.19.1.1/rpmio/expression.c:282: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#  280|   {
#  281|       char *temp;
#  282|->     if ((state->flags & RPMEXPR_DISCARD) != 0)
#  283|   	size = 0;
#  284|       temp = xmalloc(size + 1);

Error: CPPCHECK_WARNING (CWE-758): [#def16]
rpm-4.19.1.1-build/rpm-4.19.1.1/rpmio/expression.c:480: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#  478|   	v = valueMakeString(temp);
#  479|         } else {
#  480|-> 	v = valueMakeVersion(state->flags & RPMEXPR_DISCARD ? "0" : temp);
#  481|           free(temp); /* version doesn't take ownership of the string */
#  482|           if (v == 0) {

Error: CPPCHECK_WARNING (CWE-758): [#def17]
rpm-4.19.1.1-build/rpm-4.19.1.1/rpmio/expression.c:531: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#  529|       int i;
#  530|       
#  531|->     if (state->flags & RPMEXPR_DISCARD)
#  532|   	return valueMakeString(xstrdup(""));
#  533|       args = rpmhookArgsNew(argc);

Error: CPPCHECK_WARNING (CWE-758): [#def18]
rpm-4.19.1.1-build/rpm-4.19.1.1/rpmio/expression.c:722: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#  720|         int i1 = v1->data.i, i2 = v2->data.i;
#  721|   
#  722|->       if ((state->flags & RPMEXPR_DISCARD) != 0)
#  723|           continue;	/* just use v1 in discard mode */
#  724|         if ((i2 == 0) && (op == TOK_DIVIDE)) {

Error: CPPCHECK_WARNING (CWE-758): [#def19]
rpm-4.19.1.1-build/rpm-4.19.1.1/rpmio/expression.c:908: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#  906|   
#  907|       if ((op == TOK_LOGICAL_AND && !b1) || (op == TOK_LOGICAL_OR && b1))
#  908|->       state->flags |= RPMEXPR_DISCARD;		/* short-circuit */
#  909|   
#  910|       if (rdToken(state))

Error: CPPCHECK_WARNING (CWE-758): [#def20]
rpm-4.19.1.1-build/rpm-4.19.1.1/rpmio/expression.c:956: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#  954|   
#  955|       if (!cond)
#  956|-> 	state->flags |= RPMEXPR_DISCARD;	/* short-circuit */
#  957|       if (rdToken(state))
#  958|         goto err;

Error: CPPCHECK_WARNING (CWE-758): [#def21]
rpm-4.19.1.1-build/rpm-4.19.1.1/rpmio/expression.c:970: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#  968|   
#  969|       if (cond)
#  970|-> 	state->flags |= RPMEXPR_DISCARD;	/* short-circuit */
#  971|       if (rdToken(state))
#  972|         goto err;

Error: CLANG_WARNING: [#def22]
rpm-4.19.1.1-build/rpm-4.19.1.1/rpmio/rpmlog.c:451:2: warning[deadcode.DeadStores]: Value stored to 'n' is never read
#  449|   
#  450|   	va_start(ap, fmt);
#  451|-> 	n = vsnprintf(msg, nb, fmt, ap);
#  452|   	va_end(ap);
#  453|   

Error: CLANG_WARNING: [#def23]
rpm-4.19.1.1-build/rpm-4.19.1.1/tools/rpm2archive.c:173:2: warning[deadcode.DeadStores]: Value stored to 'rc' is never read
#  171|   	format_code = ARCHIVE_FORMAT_CPIO_SVR4_NOCRC;
#  172|       } else {
#  173|-> 	rc = ARCHIVE_FAILED;
#  174|       }
#  175|   

Error: CLANG_WARNING: [#def24]
rpm-4.19.1.1-build/rpm-4.19.1.1/tools/rpm2archive.c:248:2: warning[deadcode.DeadStores]: Value stored to 'rc' is never read
#  246|       /* End of iteration is not an error */
#  247|       if (rc == RPMERR_ITER_END) {
#  248|-> 	rc = 0;
#  249|       }
#  250|   

Error: CLANG_WARNING: [#def25]
rpm-4.19.1.1-build/rpm-4.19.1.1/tools/rpm2cpio.c:59:2: warning[deadcode.DeadStores]: Value stored to 'ts' is never read
#   57|   	rc = rpmReadPackageFile(ts, fdi, "rpm2cpio", &h);
#   58|   
#   59|-> 	ts = rpmtsFree(ts);
#   60|       }
#   61|   

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.7
diffbase-analyzer-version-cppcheck2.14.2
diffbase-analyzer-version-gcc14.1.1
diffbase-analyzer-version-gcc-analyzer14.1.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-23.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namerpm-4.19.92-1.fc41
diffbase-store-results-to/tmp/tmpcybal5t7/rpm-4.19.92-1.fc41.tar.xz
diffbase-time-created2024-07-03 17:53:54
diffbase-time-finished2024-07-03 17:56:36
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpcybal5t7/rpm-4.19.92-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpcybal5t7/rpm-4.19.92-1.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-23.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namerpm-4.19.1.1-1.fc40
store-results-to/tmp/tmpcn2nakhm/rpm-4.19.1.1-1.fc40.tar.xz
time-created2024-07-03 17:50:29
time-finished2024-07-03 17:53:35
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpcn2nakhm/rpm-4.19.1.1-1.fc40.tar.xz' '--gcc-analyze' '/tmp/tmpcn2nakhm/rpm-4.19.1.1-1.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9