Task #119097 - fixed.err

back to task #119097
download
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: CPPCHECK_WARNING (CWE-476):
libcbor-0.13.0/examples/readfile.c:29: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
#   27|     fseek(f, 0, SEEK_SET);
#   28|     unsigned char* buffer = malloc(length);
#   29|->   fread(buffer, length, 1, f);
#   30|   
#   31|     /* Assuming `buffer` contains `length` bytes of input data */

Error: COMPILER_WARNING (CWE-252):
libcbor-0.13.0/examples/readfile.c: scope_hint: In function ‘main’
libcbor-0.13.0/examples/readfile.c:29:3: warning[-Wunused-result]: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’
#   29 |   fread(buffer, length, 1, f);
#      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#   27|     fseek(f, 0, SEEK_SET);
#   28|     unsigned char* buffer = malloc(length);
#   29|->   fread(buffer, length, 1, f);
#   30|   
#   31|     /* Assuming `buffer` contains `length` bytes of input data */

Error: COMPILER_WARNING (CWE-252):
libcbor-0.13.0/examples/streaming_array.c: scope_hint: In function ‘main’
libcbor-0.13.0/examples/streaming_array.c:34:3: warning[-Wunused-result]: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’
#   34 |   scanf(argv[1], "%zu", &n);
#      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
#   32|     if (argc != 2) usage();
#   33|     size_t n;
#   34|->   scanf(argv[1], "%zu", &n);
#   35|     out = freopen(NULL, "wb", stdout);
#   36|     if (!out) exit(1);

Error: CPPCHECK_WARNING (CWE-476):
libcbor-0.13.0/examples/streaming_parser.c:44: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
#   42|     fseek(f, 0, SEEK_SET);
#   43|     unsigned char* buffer = malloc(length);
#   44|->   fread(buffer, length, 1, f);
#   45|   
#   46|     struct cbor_callbacks callbacks = cbor_empty_callbacks;

Error: COMPILER_WARNING (CWE-252):
libcbor-0.13.0/examples/streaming_parser.c: scope_hint: In function ‘main’
libcbor-0.13.0/examples/streaming_parser.c:44:3: warning[-Wunused-result]: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’
#   44 |   fread(buffer, length, 1, f);
#      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#   42|     fseek(f, 0, SEEK_SET);
#   43|     unsigned char* buffer = malloc(length);
#   44|->   fread(buffer, length, 1, f);
#   45|   
#   46|     struct cbor_callbacks callbacks = cbor_empty_callbacks;

Error: CPPCHECK_WARNING (CWE-682):
libcbor-0.13.0/examples/streaming_parser.c:51: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#   49|     callbacks.string = find_string;
#   50|     while (bytes_read < length) {
#   51|->     decode_result = cbor_stream_decode(buffer + bytes_read, length - bytes_read,
#   52|                                          &callbacks, NULL);
#   53|       bytes_read += decode_result.read;