libplist-2.6.0-1.fc42

List of Findings

Error: COMPILER_WARNING: [#def1]
libplist-2.6.0-build/libplist-2.6.0/cython/plist.c: warning: -Wno-implicit-function-declaration detected - is this intentional ?

Error: COMPILER_WARNING: [#def2]
libplist-2.6.0-build/libplist-2.6.0/cython/plist_util.c: warning: -Wno-implicit-function-declaration detected - is this intentional ?

Error: COMPILER_WARNING: [#def3]
libplist-2.6.0-build/libplist-2.6.0/src/Array.cpp: scope_hint: In copy constructor 'PList::Array::Array(const PList::Array&)'
libplist-2.6.0-build/libplist-2.6.0/src/Array.cpp:54:1: warning[-Wextra]: base class 'class PList::Structure' should be explicitly initialized in the copy constructor
#   54 | Array::Array(const PList::Array& a)
#      | ^~~~~
#   52|   }
#   53|   
#   54|-> Array::Array(const PList::Array& a)
#   55|   {
#   56|       _array.clear();

Error: COMPILER_WARNING: [#def4]
libplist-2.6.0-build/libplist-2.6.0/src/Dictionary.cpp: scope_hint: In copy constructor 'PList::Dictionary::Dictionary(const PList::Dictionary&)'
libplist-2.6.0-build/libplist-2.6.0/src/Dictionary.cpp:54:1: warning[-Wextra]: base class 'class PList::Structure' should be explicitly initialized in the copy constructor
#   54 | Dictionary::Dictionary(const PList::Dictionary& d)
#      | ^~~~~~~~~~
#   52|   }
#   53|   
#   54|-> Dictionary::Dictionary(const PList::Dictionary& d)
#   55|   {
#   56|       for (Dictionary::iterator it = _map.begin(); it != _map.end(); it++)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
libplist-2.6.0-build/libplist-2.6.0/src/base64.c: scope_hint: In function 'base64decode'
libplist-2.6.0-build/libplist-2.6.0/src/base64.c:105:45: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outbuf'
#  103|   
#  104|   			if (w1 >= 0 && w2 >= 0) {
#  105|-> 				outbuf[p++] = (unsigned char)(((w1 << 2) + (w2 >> 4)) & 0xFF);
#  106|   			}
#  107|   			if (w2 >= 0 && w3 >= 0) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
libplist-2.6.0-build/libplist-2.6.0/src/base64.c:108:45: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outbuf'
#  106|   			}
#  107|   			if (w2 >= 0 && w3 >= 0) {
#  108|-> 				outbuf[p++] = (unsigned char)(((w2 << 4) + (w3 >> 2)) & 0xFF);
#  109|   			}
#  110|   			if (w3 >= 0 && w4 >= 0) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def7]
libplist-2.6.0-build/libplist-2.6.0/src/base64.c:111:45: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outbuf'
#  109|   			}
#  110|   			if (w3 >= 0 && w4 >= 0) {
#  111|-> 				outbuf[p++] = (unsigned char)(((w3 << 6) + w4) & 0xFF);
#  112|   			}
#  113|   		}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
libplist-2.6.0-build/libplist-2.6.0/src/base64.c:116:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outbuf'
#  114|   	} while (1);
#  115|   
#  116|-> 	outbuf[p] = 0;
#  117|   	*size = p;
#  118|   	return outbuf;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def9]
libplist-2.6.0-build/libplist-2.6.0/src/bytearray.c: scope_hint: In function 'byte_array_new'
libplist-2.6.0-build/libplist-2.6.0/src/bytearray.c:29:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'a'
#   27|   {
#   28|   	bytearray_t *a = (bytearray_t*)malloc(sizeof(bytearray_t));
#   29|-> 	a->capacity = (initial > PAGE_SIZE) ? (initial+(PAGE_SIZE-1)) & (~(PAGE_SIZE-1)) : PAGE_SIZE;
#   30|   	a->data = malloc(a->capacity);
#   31|   	a->len = 0;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def10]
libplist-2.6.0-build/libplist-2.6.0/src/bytearray.c: scope_hint: In function 'byte_array_new_for_stream'
libplist-2.6.0-build/libplist-2.6.0/src/bytearray.c:39:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'a'
#   37|   {
#   38|   	bytearray_t *a = (bytearray_t*)malloc(sizeof(bytearray_t));
#   39|-> 	a->capacity = (size_t)-1;
#   40|   	a->data = NULL;
#   41|   	a->len = 0;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def11]
libplist-2.6.0-build/libplist-2.6.0/src/hashtable.c: scope_hint: In function 'hash_table_new'
libplist-2.6.0-build/libplist-2.6.0/src/hashtable.c:30:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'ht'
#   28|   		ht->entries[i] = NULL;
#   29|   	}
#   30|-> 	ht->count = 0;
#   31|   	ht->hash_func = hash_func;
#   32|   	ht->compare_func = compare_func;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def12]
libplist-2.6.0-build/libplist-2.6.0/src/hashtable.c: scope_hint: In function 'hash_table_insert'
libplist-2.6.0-build/libplist-2.6.0/src/hashtable.c:81:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'entry'
#   79|   	// make a new entry.
#   80|   	hashentry_t* entry = (hashentry_t*)malloc(sizeof(hashentry_t));
#   81|-> 	entry->key = key;
#   82|   	entry->value = value;
#   83|   	if (!ht->entries[idx0]) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
libplist-2.6.0-build/libplist-2.6.0/src/jplist.c: scope_hint: In function 'parse_object'
libplist-2.6.0-build/libplist-2.6.0/src/jplist.c:579:19: warning[-Wanalyzer-malloc-leak]: leak of 'unescape_string(js + (sizetype)*<unknown>.start, (long unsigned int)(*<unknown>.end - _16->start), 0)'
#  577|       size_t i = 0;
#  578|       while (i < str_len) {
#  579|->         if (strval[i] == '\\' && i < str_len-1) {
#  580|               switch (strval[i+1]) {
#  581|                   case '\"': case '/' : case '\\' : case 'b' :

Error: GCC_ANALYZER_WARNING (CWE-476): [#def14]
libplist-2.6.0-build/libplist-2.6.0/src/jplist.c: scope_hint: In function 'unescape_string'
libplist-2.6.0-build/libplist-2.6.0/src/jplist.c:579:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'strval'
#  577|       size_t i = 0;
#  578|       while (i < str_len) {
#  579|->         if (strval[i] == '\\' && i < str_len-1) {
#  580|               switch (strval[i+1]) {
#  581|                   case '\"': case '/' : case '\\' : case 'b' :

Error: GCC_ANALYZER_WARNING (CWE-688): [#def15]
libplist-2.6.0-build/libplist-2.6.0/src/out-default.c: scope_hint: In function 'node_to_string'
libplist-2.6.0-build/libplist-2.6.0/src/out-default.c:246:27: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'val' where non-null expected
libplist-2.6.0-build/libplist-2.6.0/src/out-default.c:39: included_from: Included from here.
libplist-2.6.0-build/libplist-2.6.0/src/out-default.c:474:24: note: in expansion of macro 'str_buf_new_for_stream'
libplist-2.6.0-build/libplist-2.6.0/src/out-default.c:158:13: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-default.c:160:17: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-default.c:158:13: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-default.c:160:17: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-default.c:185:17: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-default.c:187:21: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-default.c:29: included_from: Included from here.
/usr/include/time.h:99:15: note: argument 1 of 'strftime' must be non-null
#  244|                   struct tm _tmcopy;
#  245|                   copy_TM64_to_tm(btime, &_tmcopy);
#  246|->                 val_len = strftime(val, 26, "%Y-%m-%d %H:%M:%S +0000", &_tmcopy);
#  247|                   if (val_len > 0) {
#  248|                       str_buf_append(*outbuf, val, val_len);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
libplist-2.6.0-build/libplist-2.6.0/src/out-limd.c: scope_hint: In function 'node_to_string'
libplist-2.6.0-build/libplist-2.6.0/src/out-limd.c:81:16: warning[-Wanalyzer-malloc-leak]: leak of 'val'
libplist-2.6.0-build/libplist-2.6.0/src/out-limd.c:40: included_from: Included from here.
libplist-2.6.0-build/libplist-2.6.0/src/out-limd.c:432:24: note: in expansion of macro 'str_buf_new_for_stream'
#   79|   
#   80|       if (!node)
#   81|->         return PLIST_ERR_INVALID_ARG;
#   82|   
#   83|       node_data = plist_get_data(node);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def17]
libplist-2.6.0-build/libplist-2.6.0/src/out-limd.c:214:27: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'val' where non-null expected
libplist-2.6.0-build/libplist-2.6.0/src/out-limd.c:432:24: note: in expansion of macro 'str_buf_new_for_stream'
libplist-2.6.0-build/libplist-2.6.0/src/out-limd.c:30: included_from: Included from here.
/usr/include/time.h:99:15: note: argument 1 of 'strftime' must be non-null
#  212|                   struct tm _tmcopy;
#  213|                   copy_TM64_to_tm(btime, &_tmcopy);
#  214|->                 val_len = strftime(val, 24, "%Y-%m-%dT%H:%M:%SZ", &_tmcopy);
#  215|                   if (val_len > 0) {
#  216|                       str_buf_append(*outbuf, val, val_len);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def18]
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c: scope_hint: In function 'node_to_string'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:244:27: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'val' where non-null expected
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:39: included_from: Included from here.
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:448:24: note: in expansion of macro 'str_buf_new_for_stream'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:155:13: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:157:17: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:155:13: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:157:17: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:182:17: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:184:21: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:29: included_from: Included from here.
/usr/include/time.h:99:15: note: argument 1 of 'strftime' must be non-null
#  242|                   struct tm _tmcopy;
#  243|                   copy_TM64_to_tm(btime, &_tmcopy);
#  244|->                 val_len = strftime(val, 26, "%Y-%m-%d %H:%M:%S +0000", &_tmcopy);
#  245|                   if (val_len > 0) {
#  246|                       str_buf_append(*outbuf, val, val_len);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def19]
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:256:23: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'val' where non-null expected
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:448:24: note: in expansion of macro 'str_buf_new_for_stream'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:155:13: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:157:17: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:155:13: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:157:17: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:182:17: note: in expansion of macro 'str_buf_append'
libplist-2.6.0-build/libplist-2.6.0/src/out-plutil.c:184:21: note: in expansion of macro 'str_buf_append'
<built-in>: note: argument 1 of '__builtin_sprintf' must be non-null
#  254|           {
#  255|               val = (char*)malloc(88);
#  256|->             val_len = sprintf(val, "<CFKeyedArchiverUID %p [%p]>{value = %" PRIu64 "}", node, node_data, node_data->intval);
#  257|               str_buf_append(*outbuf, val, val_len);
#  258|               free(val);

Error: COMPILER_WARNING: [#def20]
libplist-2.6.0-build/libplist-2.6.0/src/plist.c: scope_hint: In function 'plist_new_plist_data'
libplist-2.6.0-build/libplist-2.6.0/src/plist.c:394:54: warning[-Wcalloc-transposed-args]: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument
#  394 |     plist_data_t data = (plist_data_t) calloc(sizeof(struct plist_data_s), 1);
#      |                                                      ^~~~~~
libplist-2.6.0-build/libplist-2.6.0/src/plist.c:394:54: note: earlier argument should specify number of elements, later size of each element
#  392|   plist_data_t plist_new_plist_data(void)
#  393|   {
#  394|->     plist_data_t data = (plist_data_t) calloc(sizeof(struct plist_data_s), 1);
#  395|       return data;
#  396|   }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def21]
libplist-2.6.0-build/libplist-2.6.0/src/plist.c: scope_hint: In function 'plist_new_key'
libplist-2.6.0-build/libplist-2.6.0/src/plist.c:487:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'data'
libplist-2.6.0-build/libplist-2.6.0/src/plist.c: scope_hint: In function 'plist_new_key'
#  485|   {
#  486|       plist_data_t data = plist_new_plist_data();
#  487|->     data->type = PLIST_KEY;
#  488|       data->strval = strdup(val);
#  489|       data->length = strlen(val);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def22]
libplist-2.6.0-build/libplist-2.6.0/src/ptrarray.c: scope_hint: In function 'ptr_array_new'
libplist-2.6.0-build/libplist-2.6.0/src/ptrarray.c:27:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'pa'
#   25|   {
#   26|   	ptrarray_t *pa = (ptrarray_t*)malloc(sizeof(ptrarray_t));
#   27|-> 	pa->pdata = (void**)malloc(sizeof(void*) * capacity);
#   28|   	pa->capacity = capacity;
#   29|   	pa->capacity_step = (capacity > 4096) ? 4096 : capacity;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def23]
libplist-2.6.0-build/libplist-2.6.0/src/xplist.c: scope_hint: In function 'node_from_xml'
libplist-2.6.0-build/libplist-2.6.0/src/xplist.c:1071:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'tag' where non-null expected
<built-in>: note: argument 1 of '__builtin_strncpy' must be non-null
# 1069|               int taglen = ctx->pos - p;
# 1070|               tag = (char*)malloc(taglen + 1);
# 1071|->             strncpy(tag, p, taglen);
# 1072|               tag[taglen] = '\0';
# 1073|               if (*ctx->pos != '>') {

Error: CPPCHECK_WARNING (CWE-401): [#def24]
libplist-2.6.0-build/libplist-2.6.0/test/plist_btest.c:52: error[memleak]: Memory leak: filestats
#   50|       {
#   51|           printf("Wrong input\n");
#   52|->         return 1;
#   53|       }
#   54|   

Error: CPPCHECK_WARNING (CWE-401): [#def25]
libplist-2.6.0-build/libplist-2.6.0/test/plist_btest.c:63: error[memleak]: Memory leak: filestats
#   61|       {
#   62|           printf("File does not exists\n");
#   63|->         return 2;
#   64|       }
#   65|       printf("File %s is open\n", file_in);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def26]
libplist-2.6.0-build/libplist-2.6.0/test/plist_btest.c: scope_hint: In function ‘main’
libplist-2.6.0-build/libplist-2.6.0/test/plist_btest.c:66:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘filestats’ where non-null expected
libplist-2.6.0-build/libplist-2.6.0/test/plist_btest.c:28: included_from: Included from here.
/usr/include/sys/stat.h:205:12: note: argument 2 of ‘stat’ must be non-null
#   64|       }
#   65|       printf("File %s is open\n", file_in);
#   66|->     stat(file_in, filestats);
#   67|       size_in = filestats->st_size;
#   68|       plist_bin = (char *) malloc(sizeof(char) * (size_in + 1));

Error: COMPILER_WARNING (CWE-252): [#def27]
libplist-2.6.0-build/libplist-2.6.0/test/plist_btest.c: scope_hint: In function ‘main’
libplist-2.6.0-build/libplist-2.6.0/test/plist_btest.c:69:5: warning[-Wunused-result]: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’
#   69 |     fread(plist_bin, sizeof(char), size_in, iplist);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   67|       size_in = filestats->st_size;
#   68|       plist_bin = (char *) malloc(sizeof(char) * (size_in + 1));
#   69|->     fread(plist_bin, sizeof(char), size_in, iplist);
#   70|       fclose(iplist);
#   71|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def28]
libplist-2.6.0-build/libplist-2.6.0/test/plist_btest.c:110:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(file_out, "wb")’ where non-null expected
libplist-2.6.0-build/libplist-2.6.0/include/plist/plist.h:90: included_from: Included from here.
libplist-2.6.0-build/libplist-2.6.0/test/plist_btest.c:23: included_from: Included from here.
/usr/include/stdio.h:735:15: note: argument 4 of ‘fwrite’ must be non-null
#  108|           FILE *oplist = NULL;
#  109|           oplist = fopen(file_out, "wb");
#  110|->         fwrite(plist_bin2, size_out2, sizeof(char), oplist);
#  111|           fclose(oplist);
#  112|       }

Error: CPPCHECK_WARNING (CWE-401): [#def29]
libplist-2.6.0-build/libplist-2.6.0/test/plist_jtest.c:52: error[memleak]: Memory leak: filestats
#   50|       {
#   51|           printf("Wrong input\n");
#   52|->         return 1;
#   53|       }
#   54|   

Error: CPPCHECK_WARNING (CWE-401): [#def30]
libplist-2.6.0-build/libplist-2.6.0/test/plist_jtest.c:63: error[memleak]: Memory leak: filestats
#   61|       {
#   62|           printf("File does not exists\n");
#   63|->         return 2;
#   64|       }
#   65|       printf("File %s is open\n", file_in);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def31]
libplist-2.6.0-build/libplist-2.6.0/test/plist_jtest.c: scope_hint: In function ‘main’
libplist-2.6.0-build/libplist-2.6.0/test/plist_jtest.c:66:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘filestats’ where non-null expected
libplist-2.6.0-build/libplist-2.6.0/test/plist_jtest.c:28: included_from: Included from here.
/usr/include/sys/stat.h:205:12: note: argument 2 of ‘stat’ must be non-null
#   64|       }
#   65|       printf("File %s is open\n", file_in);
#   66|->     stat(file_in, filestats);
#   67|       size_in = filestats->st_size;
#   68|       plist_json = (char *) malloc(sizeof(char) * (size_in + 1));

Error: COMPILER_WARNING (CWE-252): [#def32]
libplist-2.6.0-build/libplist-2.6.0/test/plist_jtest.c: scope_hint: In function ‘main’
libplist-2.6.0-build/libplist-2.6.0/test/plist_jtest.c:69:5: warning[-Wunused-result]: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’
#   69 |     fread(plist_json, sizeof(char), size_in, iplist);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   67|       size_in = filestats->st_size;
#   68|       plist_json = (char *) malloc(sizeof(char) * (size_in + 1));
#   69|->     fread(plist_json, sizeof(char), size_in, iplist);
#   70|       fclose(iplist);
#   71|       plist_json[size_in] = 0;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def33]
libplist-2.6.0-build/libplist-2.6.0/test/plist_jtest.c:110:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(file_out, "wb")’ where non-null expected
libplist-2.6.0-build/libplist-2.6.0/include/plist/plist.h:90: included_from: Included from here.
libplist-2.6.0-build/libplist-2.6.0/test/plist_jtest.c:23: included_from: Included from here.
/usr/include/stdio.h:735:15: note: argument 4 of ‘fwrite’ must be non-null
#  108|           FILE *oplist = NULL;
#  109|           oplist = fopen(file_out, "wb");
#  110|->         fwrite(plist_json2, size_out2, sizeof(char), oplist);
#  111|           fclose(oplist);
#  112|       }

Error: COMPILER_WARNING (CWE-252): [#def34]
libplist-2.6.0-build/libplist-2.6.0/test/plist_otest.c: scope_hint: In function ‘main’
libplist-2.6.0-build/libplist-2.6.0/test/plist_otest.c:69:5: warning[-Wunused-result]: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’
#   69 |     fread(plist_ostep, sizeof(char), size_in, iplist);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   67|       size_in = filestats.st_size;
#   68|       plist_ostep = (char *) malloc(sizeof(char) * (size_in + 1));
#   69|->     fread(plist_ostep, sizeof(char), size_in, iplist);
#   70|       fclose(iplist);
#   71|       plist_ostep[size_in] = 0;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def35]
libplist-2.6.0-build/libplist-2.6.0/test/plist_otest.c: scope_hint: In function ‘main’
libplist-2.6.0-build/libplist-2.6.0/test/plist_otest.c:110:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(file_out, "wb")’ where non-null expected
libplist-2.6.0-build/libplist-2.6.0/include/plist/plist.h:90: included_from: Included from here.
libplist-2.6.0-build/libplist-2.6.0/test/plist_otest.c:23: included_from: Included from here.
/usr/include/stdio.h:735:15: note: argument 4 of ‘fwrite’ must be non-null
#  108|           FILE *oplist = NULL;
#  109|           oplist = fopen(file_out, "wb");
#  110|->         fwrite(plist_ostep2, size_out2, sizeof(char), oplist);
#  111|           fclose(oplist);
#  112|       }

Error: CPPCHECK_WARNING (CWE-401): [#def36]
libplist-2.6.0-build/libplist-2.6.0/test/plist_test.c:52: error[memleak]: Memory leak: filestats
#   50|       {
#   51|           printf("Wrong input\n");
#   52|->         return 1;
#   53|       }
#   54|   

Error: CPPCHECK_WARNING (CWE-401): [#def37]
libplist-2.6.0-build/libplist-2.6.0/test/plist_test.c:63: error[memleak]: Memory leak: filestats
#   61|       {
#   62|           printf("File does not exists\n");
#   63|->         return 2;
#   64|       }
#   65|       printf("File %s is open\n", file_in);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def38]
libplist-2.6.0-build/libplist-2.6.0/test/plist_test.c: scope_hint: In function ‘main’
libplist-2.6.0-build/libplist-2.6.0/test/plist_test.c:66:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘filestats’ where non-null expected
libplist-2.6.0-build/libplist-2.6.0/test/plist_test.c:28: included_from: Included from here.
/usr/include/sys/stat.h:205:12: note: argument 2 of ‘stat’ must be non-null
#   64|       }
#   65|       printf("File %s is open\n", file_in);
#   66|->     stat(file_in, filestats);
#   67|       size_in = filestats->st_size;
#   68|       plist_xml = (char *) malloc(sizeof(char) * (size_in + 1));

Error: COMPILER_WARNING (CWE-252): [#def39]
libplist-2.6.0-build/libplist-2.6.0/test/plist_test.c: scope_hint: In function ‘main’
libplist-2.6.0-build/libplist-2.6.0/test/plist_test.c:69:5: warning[-Wunused-result]: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’
#   69 |     fread(plist_xml, sizeof(char), size_in, iplist);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   67|       size_in = filestats->st_size;
#   68|       plist_xml = (char *) malloc(sizeof(char) * (size_in + 1));
#   69|->     fread(plist_xml, sizeof(char), size_in, iplist);
#   70|       fclose(iplist);
#   71|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def40]
libplist-2.6.0-build/libplist-2.6.0/test/plist_test.c:110:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(file_out, "wb")’ where non-null expected
libplist-2.6.0-build/libplist-2.6.0/include/plist/plist.h:90: included_from: Included from here.
libplist-2.6.0-build/libplist-2.6.0/test/plist_test.c:23: included_from: Included from here.
/usr/include/stdio.h:735:15: note: argument 4 of ‘fwrite’ must be non-null
#  108|           FILE *oplist = NULL;
#  109|           oplist = fopen(file_out, "wb");
#  110|->         fwrite(plist_xml2, size_out2, sizeof(char), oplist);
#  111|           fclose(oplist);
#  112|       }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def41]
libplist-2.6.0-build/libplist-2.6.0/tools/plistutil.c: scope_hint: In function ‘parse_arguments’
libplist-2.6.0-build/libplist-2.6.0/tools/plistutil.c:96:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘options’
#   94|                   return NULL;
#   95|               }
#   96|->             options->in_file = argv[i + 1];
#   97|               i++;
#   98|               continue;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def42]
libplist-2.6.0-build/libplist-2.6.0/tools/plistutil.c:107:31: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘options’
#  105|                   return NULL;
#  106|               }
#  107|->             options->out_file = argv[i + 1];
#  108|               i++;
#  109|               continue;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def43]
libplist-2.6.0-build/libplist-2.6.0/tools/plistutil.c:119:34: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘options’
#  117|               }
#  118|               if (!strncmp(argv[i+1], "bin", 3)) {
#  119|->                 options->out_fmt = PLIST_FORMAT_BINARY;
#  120|               } else if (!strncmp(argv[i+1], "xml", 3)) {
#  121|                   options->out_fmt = PLIST_FORMAT_XML;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def44]
libplist-2.6.0-build/libplist-2.6.0/tools/plistutil.c:121:34: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘options’
#  119|                   options->out_fmt = PLIST_FORMAT_BINARY;
#  120|               } else if (!strncmp(argv[i+1], "xml", 3)) {
#  121|->                 options->out_fmt = PLIST_FORMAT_XML;
#  122|               } else if (!strncmp(argv[i+1], "json", 4)) {
#  123|                   options->out_fmt = PLIST_FORMAT_JSON;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def45]
libplist-2.6.0-build/libplist-2.6.0/tools/plistutil.c:123:34: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘options’
#  121|                   options->out_fmt = PLIST_FORMAT_XML;
#  122|               } else if (!strncmp(argv[i+1], "json", 4)) {
#  123|->                 options->out_fmt = PLIST_FORMAT_JSON;
#  124|               } else if (!strncmp(argv[i+1], "openstep", 8) || !strncmp(argv[i+1], "ostep", 5)) {
#  125|                   options->out_fmt = PLIST_FORMAT_OSTEP;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def46]
libplist-2.6.0-build/libplist-2.6.0/tools/plistutil.c:125:34: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘options’
#  123|                   options->out_fmt = PLIST_FORMAT_JSON;
#  124|               } else if (!strncmp(argv[i+1], "openstep", 8) || !strncmp(argv[i+1], "ostep", 5)) {
#  125|->                 options->out_fmt = PLIST_FORMAT_OSTEP;
#  126|               } else {
#  127|                   fprintf(stderr, "ERROR: Unsupported output format\n");

Error: GCC_ANALYZER_WARNING (CWE-476): [#def47]
libplist-2.6.0-build/libplist-2.6.0/tools/plistutil.c:136:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘options’
#  134|           else if (!strcmp(argv[i], "--compact") || !strcmp(argv[i], "-c"))
#  135|           {
#  136|->             options->flags |= OPT_COMPACT;
#  137|           }
#  138|           else if (!strcmp(argv[i], "--sort") || !strcmp(argv[i], "-s"))

Error: GCC_ANALYZER_WARNING (CWE-476): [#def48]
libplist-2.6.0-build/libplist-2.6.0/tools/plistutil.c:140:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘options’
#  138|           else if (!strcmp(argv[i], "--sort") || !strcmp(argv[i], "-s"))
#  139|           {
#  140|->             options->flags |= OPT_SORT;
#  141|           }
#  142|           else if (!strcmp(argv[i], "--print") || !strcmp(argv[i], "-p"))

Error: GCC_ANALYZER_WARNING (CWE-476): [#def49]
libplist-2.6.0-build/libplist-2.6.0/tools/plistutil.c:149:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘options’
#  147|                   return NULL;
#  148|               }
#  149|->             options->in_file = argv[i + 1];
#  150|               options->out_fmt = PLIST_FORMAT_PRINT;
#  151|               char *env_fmt = getenv("PLIST_OUTPUT_FORMAT");

Error: GCC_ANALYZER_WARNING (CWE-476): [#def50]
libplist-2.6.0-build/libplist-2.6.0/tools/plistutil.c:164:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘options’
#  162|           else if (!strcmp(argv[i], "--debug") || !strcmp(argv[i], "-d"))
#  163|           {
#  164|->             options->flags |= OPT_DEBUG;
#  165|           }
#  166|           else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h"))

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-186.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibplist-2.6.0-1.fc42
store-results-to/tmp/tmp0vilqkfl/libplist-2.6.0-1.fc42.tar.xz
time-created2024-11-13 01:39:39
time-finished2024-11-13 01:41:40
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp0vilqkfl/libplist-2.6.0-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp0vilqkfl/libplist-2.6.0-1.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9