Task #91338 - added.err

back to task #91338
download
Error: GCC_ANALYZER_WARNING (CWE-775):
libcbor-0.13.0/examples/cbor_sequence.c:21:27: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "wb")’
libcbor-0.13.0/examples/cbor_sequence.c:14:16: acquire_resource: opened here
libcbor-0.13.0/examples/cbor_sequence.c:15:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:21:27: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:21:27: throw: if ‘cbor_build_uint32’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:21:27: danger: ‘fopen(filename, "wb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   19|   
#   20|     // Create example CBOR items
#   21|->   cbor_item_t* int_item = cbor_build_uint32(42);
#   22|     cbor_item_t* string_item = cbor_build_string("Hello, CBOR!");
#   23|     cbor_item_t* array_item = cbor_new_definite_array(2);

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.13.0/examples/cbor_sequence.c:21:27: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "wb")’
libcbor-0.13.0/examples/cbor_sequence.c:14:16: acquire_memory: allocated here
libcbor-0.13.0/examples/cbor_sequence.c:15:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:21:27: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:21:27: throw: if ‘cbor_build_uint32’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:21:27: danger: ‘fopen(filename, "wb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#   19|   
#   20|     // Create example CBOR items
#   21|->   cbor_item_t* int_item = cbor_build_uint32(42);
#   22|     cbor_item_t* string_item = cbor_build_string("Hello, CBOR!");
#   23|     cbor_item_t* array_item = cbor_new_definite_array(2);

Error: GCC_ANALYZER_WARNING (CWE-775):
libcbor-0.13.0/examples/cbor_sequence.c:22:30: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "wb")’
libcbor-0.13.0/examples/cbor_sequence.c:14:16: acquire_resource: opened here
libcbor-0.13.0/examples/cbor_sequence.c:15:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:21:27: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:22:30: throw: if ‘cbor_build_string’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:22:30: danger: ‘fopen(filename, "wb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#   20|     // Create example CBOR items
#   21|     cbor_item_t* int_item = cbor_build_uint32(42);
#   22|->   cbor_item_t* string_item = cbor_build_string("Hello, CBOR!");
#   23|     cbor_item_t* array_item = cbor_new_definite_array(2);
#   24|     assert(cbor_array_push(array_item, cbor_build_uint8(1)));

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.13.0/examples/cbor_sequence.c:22:30: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "wb")’
libcbor-0.13.0/examples/cbor_sequence.c:14:16: acquire_memory: allocated here
libcbor-0.13.0/examples/cbor_sequence.c:15:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:21:27: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:22:30: throw: if ‘cbor_build_string’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:22:30: danger: ‘fopen(filename, "wb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#   20|     // Create example CBOR items
#   21|     cbor_item_t* int_item = cbor_build_uint32(42);
#   22|->   cbor_item_t* string_item = cbor_build_string("Hello, CBOR!");
#   23|     cbor_item_t* array_item = cbor_new_definite_array(2);
#   24|     assert(cbor_array_push(array_item, cbor_build_uint8(1)));

Error: GCC_ANALYZER_WARNING (CWE-775):
libcbor-0.13.0/examples/cbor_sequence.c:23:29: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "wb")’
libcbor-0.13.0/examples/cbor_sequence.c:14:16: acquire_resource: opened here
libcbor-0.13.0/examples/cbor_sequence.c:15:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:21:27: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:23:29: throw: if ‘cbor_new_definite_array’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:23:29: danger: ‘fopen(filename, "wb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
#   21|     cbor_item_t* int_item = cbor_build_uint32(42);
#   22|     cbor_item_t* string_item = cbor_build_string("Hello, CBOR!");
#   23|->   cbor_item_t* array_item = cbor_new_definite_array(2);
#   24|     assert(cbor_array_push(array_item, cbor_build_uint8(1)));
#   25|     assert(cbor_array_push(array_item, cbor_build_uint8(2)));

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.13.0/examples/cbor_sequence.c:23:29: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "wb")’
libcbor-0.13.0/examples/cbor_sequence.c:14:16: acquire_memory: allocated here
libcbor-0.13.0/examples/cbor_sequence.c:15:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:21:27: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:23:29: throw: if ‘cbor_new_definite_array’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:23:29: danger: ‘fopen(filename, "wb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
#   21|     cbor_item_t* int_item = cbor_build_uint32(42);
#   22|     cbor_item_t* string_item = cbor_build_string("Hello, CBOR!");
#   23|->   cbor_item_t* array_item = cbor_new_definite_array(2);
#   24|     assert(cbor_array_push(array_item, cbor_build_uint8(1)));
#   25|     assert(cbor_array_push(array_item, cbor_build_uint8(2)));

Error: GCC_ANALYZER_WARNING (CWE-775):
libcbor-0.13.0/examples/cbor_sequence.c:31:3: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "wb")’
libcbor-0.13.0/examples/cbor_sequence.c:14:16: acquire_resource: opened here
libcbor-0.13.0/examples/cbor_sequence.c:15:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:21:27: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:31:3: throw: if ‘cbor_serialize_alloc’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:31:3: danger: ‘fopen(filename, "wb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
#   29|     size_t buffer_size;
#   30|   
#   31|->   cbor_serialize_alloc(int_item, &buffer, &buffer_size);
#   32|     fwrite(buffer, 1, buffer_size, file);
#   33|     free(buffer);

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.13.0/examples/cbor_sequence.c:31:3: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "wb")’
libcbor-0.13.0/examples/cbor_sequence.c:14:16: acquire_memory: allocated here
libcbor-0.13.0/examples/cbor_sequence.c:15:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:21:27: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:31:3: throw: if ‘cbor_serialize_alloc’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:31:3: danger: ‘fopen(filename, "wb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0)
#   29|     size_t buffer_size;
#   30|   
#   31|->   cbor_serialize_alloc(int_item, &buffer, &buffer_size);
#   32|     fwrite(buffer, 1, buffer_size, file);
#   33|     free(buffer);

Error: GCC_ANALYZER_WARNING (CWE-775):
libcbor-0.13.0/examples/cbor_sequence.c:57:3: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libcbor-0.13.0/examples/cbor_sequence.c:51:16: acquire_resource: opened here
libcbor-0.13.0/examples/cbor_sequence.c:52:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:57:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:57:3: throw: if ‘fseek’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:57:3: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/0)
#   55|     }
#   56|   
#   57|->   fseek(file, 0, SEEK_END);
#   58|     size_t file_size = ftell(file);
#   59|     fseek(file, 0, SEEK_SET);

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.13.0/examples/cbor_sequence.c:57:3: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libcbor-0.13.0/examples/cbor_sequence.c:51:16: acquire_memory: allocated here
libcbor-0.13.0/examples/cbor_sequence.c:52:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:57:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:57:3: throw: if ‘fseek’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:57:3: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/0)
#   55|     }
#   56|   
#   57|->   fseek(file, 0, SEEK_END);
#   58|     size_t file_size = ftell(file);
#   59|     fseek(file, 0, SEEK_SET);

Error: GCC_ANALYZER_WARNING (CWE-775):
libcbor-0.13.0/examples/cbor_sequence.c:58:22: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libcbor-0.13.0/examples/cbor_sequence.c:51:16: acquire_resource: opened here
libcbor-0.13.0/examples/cbor_sequence.c:52:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:57:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:58:22: throw: if ‘ftell’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:58:22: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/0)
#   56|   
#   57|     fseek(file, 0, SEEK_END);
#   58|->   size_t file_size = ftell(file);
#   59|     fseek(file, 0, SEEK_SET);
#   60|   

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.13.0/examples/cbor_sequence.c:58:22: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libcbor-0.13.0/examples/cbor_sequence.c:51:16: acquire_memory: allocated here
libcbor-0.13.0/examples/cbor_sequence.c:52:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:57:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:58:22: throw: if ‘ftell’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:58:22: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/0)
#   56|   
#   57|     fseek(file, 0, SEEK_END);
#   58|->   size_t file_size = ftell(file);
#   59|     fseek(file, 0, SEEK_SET);
#   60|   

Error: GCC_ANALYZER_WARNING (CWE-775):
libcbor-0.13.0/examples/cbor_sequence.c:59:3: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libcbor-0.13.0/examples/cbor_sequence.c:51:16: acquire_resource: opened here
libcbor-0.13.0/examples/cbor_sequence.c:52:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:57:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:59:3: throw: if ‘fseek’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:59:3: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/0)
#   57|     fseek(file, 0, SEEK_END);
#   58|     size_t file_size = ftell(file);
#   59|->   fseek(file, 0, SEEK_SET);
#   60|   
#   61|     unsigned char* buffer = malloc(file_size);

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.13.0/examples/cbor_sequence.c:59:3: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libcbor-0.13.0/examples/cbor_sequence.c:51:16: acquire_memory: allocated here
libcbor-0.13.0/examples/cbor_sequence.c:52:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:57:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:59:3: throw: if ‘fseek’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:59:3: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/0)
#   57|     fseek(file, 0, SEEK_END);
#   58|     size_t file_size = ftell(file);
#   59|->   fseek(file, 0, SEEK_SET);
#   60|   
#   61|     unsigned char* buffer = malloc(file_size);

Error: COMPILER_WARNING (CWE-252):
libcbor-0.13.0/examples/cbor_sequence.c: scope_hint: In function ‘read_cbor_sequence’
libcbor-0.13.0/examples/cbor_sequence.c:68:3: warning[-Wunused-result]: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’
#   68 |   fread(buffer, 1, file_size, file);
#      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   66|     }
#   67|   
#   68|->   fread(buffer, 1, file_size, file);
#   69|     fclose(file);
#   70|   

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.13.0/examples/cbor_sequence.c:75:25: warning[-Wanalyzer-malloc-leak]: leak of ‘buffer’
libcbor-0.13.0/examples/cbor_sequence.c:52:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:57:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:61:27: acquire_memory: allocated here
libcbor-0.13.0/examples/cbor_sequence.c:62:6: branch_false: following ‘false’ branch (when ‘buffer’ is non-NULL)...
libcbor-0.13.0/examples/cbor_sequence.c:68:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:74:10: branch_true: following ‘true’ branch (when ‘offset < file_size’)...
libcbor-0.13.0/examples/cbor_sequence.c:75:25: branch_true: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:75:25: throw: if ‘cbor_load’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:75:25: danger: ‘buffer’ leaks here; was allocated at [(3)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/2)
#   73|   
#   74|     while (offset < file_size) {
#   75|->     cbor_item_t* item = cbor_load(buffer + offset, file_size - offset, &result);
#   76|       if (result.error.code != CBOR_ERR_NONE) {
#   77|         fprintf(stderr, "Error: Failed to parse CBOR item at offset %zu\n",

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.13.0/examples/cbor_sequence.c:82:5: warning[-Wanalyzer-malloc-leak]: leak of ‘buffer’
libcbor-0.13.0/examples/cbor_sequence.c:52:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:57:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:61:27: acquire_memory: allocated here
libcbor-0.13.0/examples/cbor_sequence.c:62:6: branch_false: following ‘false’ branch (when ‘buffer’ is non-NULL)...
libcbor-0.13.0/examples/cbor_sequence.c:68:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:74:10: branch_true: following ‘true’ branch (when ‘offset < file_size’)...
libcbor-0.13.0/examples/cbor_sequence.c:75:25: branch_true: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:76:8: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:82:5: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:82:5: throw: if ‘cbor_describe’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:82:5: danger: ‘buffer’ leaks here; was allocated at [(3)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/2)
#   80|       }
#   81|   
#   82|->     cbor_describe(item, stdout);
#   83|       printf("\n");
#   84|   

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.13.0/examples/cbor_sequence.c:86:5: warning[-Wanalyzer-malloc-leak]: leak of ‘buffer’
libcbor-0.13.0/examples/cbor_sequence.c:52:6: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:57:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:61:27: acquire_memory: allocated here
libcbor-0.13.0/examples/cbor_sequence.c:62:6: branch_false: following ‘false’ branch (when ‘buffer’ is non-NULL)...
libcbor-0.13.0/examples/cbor_sequence.c:68:3: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:74:10: branch_true: following ‘true’ branch (when ‘offset < file_size’)...
libcbor-0.13.0/examples/cbor_sequence.c:75:25: branch_true: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:76:8: branch_false: following ‘false’ branch...
libcbor-0.13.0/examples/cbor_sequence.c:82:5: branch_false: ...to here
libcbor-0.13.0/examples/cbor_sequence.c:86:5: throw: if ‘cbor_decref’ throws an exception...
libcbor-0.13.0/examples/cbor_sequence.c:86:5: danger: ‘buffer’ leaks here; was allocated at [(3)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/2)
#   84|   
#   85|       offset += result.read;
#   86|->     cbor_decref(&item);
#   87|     }
#   88|