Newly introduced defects
List of Defects
Error: CLANG_WARNING: [#def1]
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): [#def2]
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): [#def3]
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): [#def4]
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: GCC_ANALYZER_WARNING (CWE-476): [#def5]
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: GCC_ANALYZER_WARNING (CWE-476): [#def6]
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): [#def7]
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): [#def8]
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): [#def9]
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): [#def10]
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: [#def11]
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): [#def12]
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): [#def13]
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: [#def14]
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: [#def15]
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: [#def16]
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: [#def17]
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-clang | 18.1.7 |
analyzer-version-cppcheck | 2.14.2 |
analyzer-version-gcc | 14.1.1 |
analyzer-version-gcc-analyzer | 14.1.1 |
analyzer-version-shellcheck | 0.10.0 |
diffbase-analyzer-version-clang | 18.1.7 |
diffbase-analyzer-version-cppcheck | 2.14.2 |
diffbase-analyzer-version-gcc | 14.1.1 |
diffbase-analyzer-version-gcc-analyzer | 14.1.1 |
diffbase-analyzer-version-shellcheck | 0.10.0 |
diffbase-enabled-plugins | clang, cppcheck, gcc, shellcheck |
diffbase-exit-code | 0 |
diffbase-host | ip-172-16-1-180.us-west-2.compute.internal |
diffbase-mock-config | fedora-41-x86_64 |
diffbase-project-name | iniparser-4.1-16.fc40 |
diffbase-store-results-to | /tmp/tmp9f78rbfo/iniparser-4.1-16.fc40.tar.xz |
diffbase-time-created | 2024-07-03 13:20:10 |
diffbase-time-finished | 2024-07-03 13:21:22 |
diffbase-tool | csmock |
diffbase-tool-args | '/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp9f78rbfo/iniparser-4.1-16.fc40.tar.xz' '--gcc-analyze' '/tmp/tmp9f78rbfo/iniparser-4.1-16.fc40.src.rpm' |
diffbase-tool-version | csmock-3.5.3-1.el9 |
enabled-plugins | clang, cppcheck, gcc, shellcheck |
exit-code | 0 |
host | ip-172-16-1-180.us-west-2.compute.internal |
mock-config | fedora-41-x86_64 |
project-name | iniparser-4.2.2-1.fc41 |
store-results-to | /tmp/tmps4a_qp5f/iniparser-4.2.2-1.fc41.tar.xz |
time-created | 2024-07-03 13:21:31 |
time-finished | 2024-07-03 13:22:34 |
title | Newly introduced defects |
tool | csmock |
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-version | csmock-3.5.3-1.el9 |