iniparser-4.2.2-1.fc41

List of Defects

Error: CPPCHECK_WARNING: [#def1]
iniparser-4.2.2-build/iniparser-4.2.2/src/dictionary.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def2]
iniparser-4.2.2-build/iniparser-4.2.2/src/dictionary.c:158:13: warning[unix.Malloc]: Argument to free() is a constant address (128), which is not memory allocated by malloc()
#  156|           d->hash = (unsigned*) calloc(size, sizeof *d->hash);
#  157|           if (!d->size || !d->val || !d->hash) {
#  158|->             free((void *) d->size);
#  159|               free((void *) d->val);
#  160|               free((void *) d->hash);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
iniparser-4.2.2-build/iniparser-4.2.2/src/dictionary.c: scope_hint: In function ‘dictionary_new’
iniparser-4.2.2-build/iniparser-4.2.2/src/dictionary.c:161:13: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
#  159|               free((void *) d->val);
#  160|               free((void *) d->hash);
#  161|->             free(d);
#  162|               d = NULL;
#  163|           }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
iniparser-4.2.2-build/iniparser-4.2.2/src/dictionary.c: scope_hint: In function ‘dictionary_get.part.0’
iniparser-4.2.2-build/iniparser-4.2.2/src/dictionary.c:219:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*d.key + i * 8’
iniparser-4.2.2-build/iniparser-4.2.2/test/test_dictionary.c:4: included_from: Included from here.
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.h:102:107: note: in definition of macro ‘CuAssertPtrEquals’
#  217|       hash = dictionary_hash(key);
#  218|       for (i=0 ; i<d->size ; i++) {
#  219|->         if (d->key[i]==NULL)
#  220|               continue ;
#  221|           /* Compare hash */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
iniparser-4.2.2-build/iniparser-4.2.2/src/dictionary.c: scope_hint: In function ‘dictionary_set’
iniparser-4.2.2-build/iniparser-4.2.2/src/dictionary.c:295:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*d.key + i * 8’
#  293|          d->size. Because d->n < d->size this will necessarily
#  294|          terminate. */
#  295|->     for (i=d->n ; d->key[i] ; ) {
#  296|           if(++i == d->size) i = 0;
#  297|       }

Error: CPPCHECK_WARNING: [#def6]
iniparser-4.2.2-build/iniparser-4.2.2/src/iniparser.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-476): [#def7]
iniparser-4.2.2-build/iniparser-4.2.2/src/iniparser.c: scope_hint: In function ‘parse_quoted_value.part.0’
iniparser-4.2.2-build/iniparser-4.2.2/src/iniparser.c:700:14: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘value’
#  698|       }
#  699|   end_of_value:
#  700|->     value[v] = '\0';
#  701|       free(quoted);
#  702|   }

Error: CLANG_WARNING: [#def8]
iniparser-4.2.2-build/iniparser-4.2.2/src/iniparser.c:728:5: warning[deadcode.DeadStores]: Value stored to 'sta' is never read
#  726|       len = strstrip(line);
#  727|   
#  728|->     sta = LINE_UNPROCESSED ;
#  729|       if (len<1) {
#  730|           /* Empty line */

Error: CLANG_WARNING: [#def9]
iniparser-4.2.2-build/iniparser-4.2.2/src/iniparser.c:862:13: warning[deadcode.DeadStores]: Value stored to 'last' is never read
#  860|               continue ;
#  861|           } else {
#  862|->             last=0 ;
#  863|           }
#  864|           switch (iniparser_line(line, section, key, val)) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def10]
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c: scope_hint: In function ‘CuStringInit’
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c:37:24: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘string.buffer’
#   35|   	str->size = STRING_MAX;
#   36|   	str->buffer = (char*) malloc(sizeof(char) * str->size);
#   37|-> 	str->buffer[0] = '\0';
#   38|   }
#   39|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c:59:21: warning[-Wanalyzer-malloc-leak]: leak of ‘*str.buffer’
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c: scope_hint: In function ‘CuStringAppend’
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c: scope_hint: In function ‘CuStringAppend’
#   57|   void CuStringResize(CuString* str, int newSize)
#   58|   {
#   59|-> 	str->buffer = (char*) realloc(str->buffer, sizeof(char) * newSize);
#   60|   	str->size = newSize;
#   61|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c:59:21: warning[-Wanalyzer-malloc-leak]: leak of ‘string.buffer’
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c: scope_hint: In function ‘CuStringAppend’
#   57|   void CuStringResize(CuString* str, int newSize)
#   58|   {
#   59|-> 	str->buffer = (char*) realloc(str->buffer, sizeof(char) * newSize);
#   60|   	str->size = newSize;
#   61|   }

Error: GCC_ANALYZER_WARNING (CWE-688): [#def13]
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c: scope_hint: In function ‘CuStringAppend’
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c:75:9: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c: scope_hint: In function ‘CuStringAppend’
<built-in>: note: argument 1 of ‘__builtin_strcat’ must be non-null
#   73|   		CuStringResize(str, str->length + length + 1 + STRING_INC);
#   74|   	str->length += length;
#   75|-> 	strcat(str->buffer, text);
#   76|   }
#   77|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def14]
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c:281:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘testSuite’
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c:8: included_from: Included from here.
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c: scope_hint: In function ‘CuSuiteNew’
iniparser-4.2.2-build/iniparser-4.2.2/test/CuTest.c:288:30: note: in expansion of macro ‘CU_ALLOC’
#  279|   void CuSuiteInit(CuSuite* testSuite)
#  280|   {
#  281|-> 	testSuite->count = 0;
#  282|   	testSuite->failCount = 0;
#  283|           memset(testSuite->list, 0, sizeof(testSuite->list));

Error: CPPCHECK_WARNING: [#def15]
iniparser-4.2.2-build/iniparser-4.2.2/test/test_dictionary.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
iniparser-4.2.2-build/iniparser-4.2.2/test/test_dictionary.c: scope_hint: In function ‘get_dump’
iniparser-4.2.2-build/iniparser-4.2.2/test/test_dictionary.c:127:9: warning[-Wanalyzer-malloc-leak]: leak of ‘dump_buff’
#  125|       }
#  126|       if (fread(dump_buff, 1, dump_size, fd) != (size_t)dump_size) {
#  127|->         fclose(fd);
#  128|           return NULL;
#  129|       }

Error: CPPCHECK_WARNING (CWE-401): [#def17]
iniparser-4.2.2-build/iniparser-4.2.2/test/test_dictionary.c:128: error[memleak]: Memory leak: dump_buff
#  126|       if (fread(dump_buff, 1, dump_size, fd) != (size_t)dump_size) {
#  127|           fclose(fd);
#  128|->         return NULL;
#  129|       }
#  130|   

Error: CPPCHECK_WARNING: [#def18]
iniparser-4.2.2-build/iniparser-4.2.2/test/test_iniparser.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def19]
iniparser-4.2.2-build/iniparser-4.2.2/test/test_iniparser.c:763:17: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  761|       dir = opendir(GOOD_INI_PATH);
#  762|       CuAssertPtrNotNullMsg(tc, "Cannot open good .ini conf directory", dir);
#  763|->     for (curr = readdir(dir); curr != NULL; curr = readdir(dir)) {
#  764|           sprintf(ini_path, "%s/%s", GOOD_INI_PATH, curr->d_name);
#  765|           stat(ini_path, &curr_stat);

Error: CLANG_WARNING: [#def20]
iniparser-4.2.2-build/iniparser-4.2.2/test/test_iniparser.c:777:17: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  775|       dir = opendir(BAD_INI_PATH);
#  776|       CuAssertPtrNotNullMsg(tc, "Cannot open bad .ini conf directory", dir);
#  777|->     for (curr = readdir(dir); curr != NULL; curr = readdir(dir)) {
#  778|           sprintf(ini_path, "%s/%s", BAD_INI_PATH, curr->d_name);
#  779|           stat(ini_path, &curr_stat);

Error: CLANG_WARNING: [#def21]
iniparser-4.2.2-build/iniparser-4.2.2/test/test_iniparser.c:1014:60: warning[core.NullDereference]: Access to field 'key' results in a dereference of a null pointer (loaded from variable 'dic')
# 1012|       for (i = 1; i < 8; i++)
# 1013|       {
# 1014|->         CuAssertIntEquals(tc, 1, iniparser_find_entry(dic, dic->key[i]));
# 1015|       }
# 1016|       CuAssertIntEquals(tc, 0, iniparser_find_entry(dic, "dummy"));

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
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-180.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-nameiniparser-4.2.2-1.fc41
store-results-to/tmp/tmps4a_qp5f/iniparser-4.2.2-1.fc41.tar.xz
time-created2024-07-03 13:21:31
time-finished2024-07-03 13:22:34
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmps4a_qp5f/iniparser-4.2.2-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmps4a_qp5f/iniparser-4.2.2-1.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9