Task #131532 - added.err

back to task #131532
download
Error: GCC_ANALYZER_WARNING (CWE-775):
libcbor-0.14.0/examples/capped_alloc.c:133:6: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(argv[1], "rb")’
libcbor-0.14.0/examples/capped_alloc.c:119:6: branch_false: following ‘false’ branch (when ‘argc == 2’)...
libcbor-0.14.0/examples/capped_alloc.c:122:3: branch_false: ...to here
libcbor-0.14.0/examples/capped_alloc.c:124:13: acquire_resource: opened here
libcbor-0.14.0/examples/capped_alloc.c:125:6: branch_false: following ‘false’ branch...
libcbor-0.14.0/examples/capped_alloc.c:126:3: branch_false: ...to here
libcbor-0.14.0/examples/capped_alloc.c:133:6: danger: ‘fopen(argv[1], "rb")’ leaks here; was opened at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  131|      * libcbor's internal allocations, not to our own buffer. */
#  132|     unsigned char* buffer = malloc(length);
#  133|->   if (buffer == NULL || fread(buffer, length, 1, f) != 1) {
#  134|       fprintf(stderr, "Failed to read input\n");
#  135|       exit(1);

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.14.0/examples/capped_alloc.c:133:6: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(argv[1], "rb")’
libcbor-0.14.0/examples/capped_alloc.c:119:6: branch_false: following ‘false’ branch (when ‘argc == 2’)...
libcbor-0.14.0/examples/capped_alloc.c:122:3: branch_false: ...to here
libcbor-0.14.0/examples/capped_alloc.c:124:13: acquire_memory: allocated here
libcbor-0.14.0/examples/capped_alloc.c:125:6: branch_false: following ‘false’ branch...
libcbor-0.14.0/examples/capped_alloc.c:126:3: branch_false: ...to here
libcbor-0.14.0/examples/capped_alloc.c:133:6: danger: ‘fopen(argv[1], "rb")’ leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  131|      * libcbor's internal allocations, not to our own buffer. */
#  132|     unsigned char* buffer = malloc(length);
#  133|->   if (buffer == NULL || fread(buffer, length, 1, f) != 1) {
#  134|       fprintf(stderr, "Failed to read input\n");
#  135|       exit(1);

Error: GCC_ANALYZER_WARNING (CWE-775):
libcbor-0.14.0/examples/capped_alloc.c:133:7: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(argv[1], "rb")’
libcbor-0.14.0/examples/capped_alloc.c:119:6: branch_false: following ‘false’ branch (when ‘argc == 2’)...
libcbor-0.14.0/examples/capped_alloc.c:122:3: branch_false: ...to here
libcbor-0.14.0/examples/capped_alloc.c:124:13: acquire_resource: opened here
libcbor-0.14.0/examples/capped_alloc.c:125:6: branch_false: following ‘false’ branch...
libcbor-0.14.0/examples/capped_alloc.c:126:3: branch_false: ...to here
libcbor-0.14.0/examples/capped_alloc.c:133:6: branch_false: following ‘false’ branch (when ‘buffer’ is non-NULL)...
libcbor-0.14.0/examples/capped_alloc.c:133:25: branch_false: ...to here
libcbor-0.14.0/examples/capped_alloc.c:133:7: danger: ‘fopen(argv[1], "rb")’ leaks here; was opened at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
#  131|      * libcbor's internal allocations, not to our own buffer. */
#  132|     unsigned char* buffer = malloc(length);
#  133|->   if (buffer == NULL || fread(buffer, length, 1, f) != 1) {
#  134|       fprintf(stderr, "Failed to read input\n");
#  135|       exit(1);

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.14.0/examples/capped_alloc.c:133:7: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(argv[1], "rb")’
libcbor-0.14.0/examples/capped_alloc.c:119:6: branch_false: following ‘false’ branch (when ‘argc == 2’)...
libcbor-0.14.0/examples/capped_alloc.c:122:3: branch_false: ...to here
libcbor-0.14.0/examples/capped_alloc.c:124:13: acquire_memory: allocated here
libcbor-0.14.0/examples/capped_alloc.c:125:6: branch_false: following ‘false’ branch...
libcbor-0.14.0/examples/capped_alloc.c:126:3: branch_false: ...to here
libcbor-0.14.0/examples/capped_alloc.c:133:6: branch_false: following ‘false’ branch (when ‘buffer’ is non-NULL)...
libcbor-0.14.0/examples/capped_alloc.c:133:25: branch_false: ...to here
libcbor-0.14.0/examples/capped_alloc.c:133:7: danger: ‘fopen(argv[1], "rb")’ leaks here; was allocated at [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
#  131|      * libcbor's internal allocations, not to our own buffer. */
#  132|     unsigned char* buffer = malloc(length);
#  133|->   if (buffer == NULL || fread(buffer, length, 1, f) != 1) {
#  134|       fprintf(stderr, "Failed to read input\n");
#  135|       exit(1);

Error: CPPCHECK_WARNING (CWE-476):
libcbor-0.14.0/examples/readfile.c:30: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
#   28|     fseek(f, 0, SEEK_SET);
#   29|     unsigned char* buffer = malloc(length);
#   30|->   if (fread(buffer, length, 1, f) != 1) {
#   31|       fprintf(stderr, "Failed to read input\n");
#   32|       exit(1);

Error: GCC_ANALYZER_WARNING (CWE-775):
libcbor-0.14.0/examples/readfile.c:30:6: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(argv[1], "rb")’
libcbor-0.14.0/examples/readfile.c:23:6: branch_false: following ‘false’ branch (when ‘argc == 2’)...
libcbor-0.14.0/examples/readfile.c:24:13: branch_false: ...to here
libcbor-0.14.0/examples/readfile.c:24:13: acquire_resource: opened here
libcbor-0.14.0/examples/readfile.c:25:6: branch_false: following ‘false’ branch...
libcbor-0.14.0/examples/readfile.c:26:3: branch_false: ...to here
libcbor-0.14.0/examples/readfile.c:30:6: danger: ‘fopen(argv[1], "rb")’ leaks here; was opened at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   28|     fseek(f, 0, SEEK_SET);
#   29|     unsigned char* buffer = malloc(length);
#   30|->   if (fread(buffer, length, 1, f) != 1) {
#   31|       fprintf(stderr, "Failed to read input\n");
#   32|       exit(1);

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.14.0/examples/readfile.c:30:6: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(argv[1], "rb")’
libcbor-0.14.0/examples/readfile.c:23:6: branch_false: following ‘false’ branch (when ‘argc == 2’)...
libcbor-0.14.0/examples/readfile.c:24:13: branch_false: ...to here
libcbor-0.14.0/examples/readfile.c:24:13: acquire_memory: allocated here
libcbor-0.14.0/examples/readfile.c:25:6: branch_false: following ‘false’ branch...
libcbor-0.14.0/examples/readfile.c:26:3: branch_false: ...to here
libcbor-0.14.0/examples/readfile.c:30:6: danger: ‘fopen(argv[1], "rb")’ leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#   28|     fseek(f, 0, SEEK_SET);
#   29|     unsigned char* buffer = malloc(length);
#   30|->   if (fread(buffer, length, 1, f) != 1) {
#   31|       fprintf(stderr, "Failed to read input\n");
#   32|       exit(1);

Error: CPPCHECK_WARNING (CWE-476):
libcbor-0.14.0/examples/streaming_parser.c:45: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
#   43|     fseek(f, 0, SEEK_SET);
#   44|     unsigned char* buffer = malloc(length);
#   45|->   if (fread(buffer, length, 1, f) != 1) {
#   46|       fprintf(stderr, "Failed to read input\n");
#   47|       exit(1);

Error: GCC_ANALYZER_WARNING (CWE-775):
libcbor-0.14.0/examples/streaming_parser.c:45:6: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(argv[1], "rb")’
libcbor-0.14.0/examples/streaming_parser.c:38:6: branch_false: following ‘false’ branch (when ‘argc == 2’)...
libcbor-0.14.0/examples/streaming_parser.c:39:13: branch_false: ...to here
libcbor-0.14.0/examples/streaming_parser.c:39:13: acquire_resource: opened here
libcbor-0.14.0/examples/streaming_parser.c:40:6: branch_false: following ‘false’ branch...
libcbor-0.14.0/examples/streaming_parser.c:41:3: branch_false: ...to here
libcbor-0.14.0/examples/streaming_parser.c:45:6: danger: ‘fopen(argv[1], "rb")’ leaks here; was opened at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   43|     fseek(f, 0, SEEK_SET);
#   44|     unsigned char* buffer = malloc(length);
#   45|->   if (fread(buffer, length, 1, f) != 1) {
#   46|       fprintf(stderr, "Failed to read input\n");
#   47|       exit(1);

Error: GCC_ANALYZER_WARNING (CWE-401):
libcbor-0.14.0/examples/streaming_parser.c:45:6: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(argv[1], "rb")’
libcbor-0.14.0/examples/streaming_parser.c:38:6: branch_false: following ‘false’ branch (when ‘argc == 2’)...
libcbor-0.14.0/examples/streaming_parser.c:39:13: branch_false: ...to here
libcbor-0.14.0/examples/streaming_parser.c:39:13: acquire_memory: allocated here
libcbor-0.14.0/examples/streaming_parser.c:40:6: branch_false: following ‘false’ branch...
libcbor-0.14.0/examples/streaming_parser.c:41:3: branch_false: ...to here
libcbor-0.14.0/examples/streaming_parser.c:45:6: danger: ‘fopen(argv[1], "rb")’ leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#   43|     fseek(f, 0, SEEK_SET);
#   44|     unsigned char* buffer = malloc(length);
#   45|->   if (fread(buffer, length, 1, f) != 1) {
#   46|       fprintf(stderr, "Failed to read input\n");
#   47|       exit(1);

Error: COMPILER_WARNING (CWE-252):
libcbor-0.14.0/test/cbor_serialize_test.c: scope_hint: In function ‘test_serialize_indef_bytestring_size_overflow’
libcbor-0.14.0/test/cbor_serialize_test.c:197:3: warning[-Wunused-result]: ignoring return value of ‘cbor_bytestring_add_chunk’, declared with attribute ‘nodiscard’
#  197 |   cbor_bytestring_add_chunk(item, cbor_move(chunk));
#      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libcbor-0.14.0/src/cbor.h:15: included_from: Included from here.
libcbor-0.14.0/test/assertions.h:9: included_from: Included from here.
libcbor-0.14.0/test/cbor_serialize_test.c:20: included_from: Included from here.
libcbor-0.14.0/src/cbor/bytestrings.h:108:18: note: declared here
#  108 | CBOR_EXPORT bool cbor_bytestring_add_chunk(cbor_item_t* item,
#      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~
#  195|     unsigned char* data = malloc(1);
#  196|     cbor_bytestring_set_handle(chunk, data, SIZE_MAX);
#  197|->   cbor_bytestring_add_chunk(item, cbor_move(chunk));
#  198|   
#  199|     assert_size_equal(cbor_serialized_size(item), 0);

Error: COMPILER_WARNING (CWE-252):
libcbor-0.14.0/test/cbor_serialize_test.c:197:3: warning[-Wunused-result]: ignoring return value of ‘cbor_bytestring_add_chunk’, declared with attribute ‘nodiscard’
#  195|     unsigned char* data = malloc(1);
#  196|     cbor_bytestring_set_handle(chunk, data, SIZE_MAX);
#  197|->   cbor_bytestring_add_chunk(item, cbor_move(chunk));
#  198|   
#  199|     assert_size_equal(cbor_serialized_size(item), 0);

Error: COMPILER_WARNING (CWE-252):
libcbor-0.14.0/test/cbor_serialize_test.c: scope_hint: In function ‘test_serialize_indef_string_size_overflow’
libcbor-0.14.0/test/cbor_serialize_test.c:213:3: warning[-Wunused-result]: ignoring return value of ‘cbor_string_add_chunk’, declared with attribute ‘nodiscard’
#  213 |   cbor_string_add_chunk(item, cbor_move(chunk));
#      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libcbor-0.14.0/src/cbor.h:19: included_from: Included from here.
libcbor-0.14.0/src/cbor/strings.h:126:34: note: declared here
#  126 | _CBOR_NODISCARD CBOR_EXPORT bool cbor_string_add_chunk(cbor_item_t* item,
#      |                                  ^~~~~~~~~~~~~~~~~~~~~
#  211|     chunk->data = data;
#  212|     chunk->metadata.string_metadata.length = SIZE_MAX;
#  213|->   cbor_string_add_chunk(item, cbor_move(chunk));
#  214|   
#  215|     assert_size_equal(cbor_serialized_size(item), 0);

Error: COMPILER_WARNING (CWE-252):
libcbor-0.14.0/test/cbor_serialize_test.c:213:3: warning[-Wunused-result]: ignoring return value of ‘cbor_string_add_chunk’, declared with attribute ‘nodiscard’
#  211|     chunk->data = data;
#  212|     chunk->metadata.string_metadata.length = SIZE_MAX;
#  213|->   cbor_string_add_chunk(item, cbor_move(chunk));
#  214|   
#  215|     assert_size_equal(cbor_serialized_size(item), 0);