Task #130830 - codec2-1.2.0-9.fc44/scan-results.err
back to task #130830download
Error: GCC_ANALYZER_WARNING (CWE-775):
codec2-1.2.0/demo/c2demo.c:53:15: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(argv[1], "rb")’
codec2-1.2.0/demo/c2demo.c:43:6: branch_false: following ‘false’ branch (when ‘argc == 3’)...
codec2-1.2.0/demo/c2demo.c:48:14: branch_false: ...to here
codec2-1.2.0/demo/c2demo.c:48:14: acquire_resource: opened here
codec2-1.2.0/demo/c2demo.c:48:6: branch_false: following ‘false’ branch...
codec2-1.2.0/demo/c2demo.c:53:15: branch_false: ...to here
codec2-1.2.0/demo/c2demo.c:53:15: danger: ‘fopen(argv[1], "rb")’ leaks here; was opened at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
# 51| }
# 52|
# 53|-> if ((fout = fopen(argv[2], "wb")) == NULL) {
# 54| fprintf(stderr, "Error opening output speech file: %s\n", argv[2]);
# 55| exit(1);
Error: GCC_ANALYZER_WARNING (CWE-401):
codec2-1.2.0/demo/c2demo.c:53:15: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(argv[1], "rb")’
codec2-1.2.0/demo/c2demo.c:43:6: branch_false: following ‘false’ branch (when ‘argc == 3’)...
codec2-1.2.0/demo/c2demo.c:48:14: branch_false: ...to here
codec2-1.2.0/demo/c2demo.c:48:14: acquire_memory: allocated here
codec2-1.2.0/demo/c2demo.c:48:6: branch_false: following ‘false’ branch...
codec2-1.2.0/demo/c2demo.c:53:15: branch_false: ...to here
codec2-1.2.0/demo/c2demo.c:53:15: danger: ‘fopen(argv[1], "rb")’ leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
# 51| }
# 52|
# 53|-> if ((fout = fopen(argv[2], "wb")) == NULL) {
# 54| fprintf(stderr, "Error opening output speech file: %s\n", argv[2]);
# 55| exit(1);
Error: COMPILER_WARNING (CWE-563):
codec2-1.2.0/src/c2dec.c: scope_hint: In function ‘main’
codec2-1.2.0/src/c2dec.c:112:9: warning[-Wunused-variable]: unused variable ‘nread’
# 112 | int nread = fread(&in_hdr, sizeof(in_hdr), 1, fin);
# | ^~~~~
# 110| char *ext = strrchr(argv[2], '.');
# 111| if ((ext != NULL) && (strcmp(ext, ".c2") == 0)) {
# 112|-> int nread = fread(&in_hdr, sizeof(in_hdr), 1, fin);
# 113| assert(nread == 1);
# 114|
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/c2dec.c:271: error[uninitvar]: Uninitialized variable: state
# 269| assert(softdec == 0);
# 270| burst_timer += (float)nbit / bit_rate;
# 271|-> fprintf(stderr, "burst_timer: %f state: %d\n", burst_timer, state);
# 272|
# 273| next_state = state;
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/c2dec.c:320:7: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘bits’ where non-null expected
codec2-1.2.0/src/c2dec.c:90:6: branch_false: following ‘false’ branch (when ‘argc > 3’)...
codec2-1.2.0/src/c2dec.c:92:7: branch_false: ...to here
codec2-1.2.0/src/c2dec.c:92:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/c2dec.c:93:5: branch_true: ...to here
codec2-1.2.0/src/c2dec.c:100:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/c2dec.c:101:5: branch_true: ...to here
codec2-1.2.0/src/c2dec.c:111:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/c2dec.c:168:27: acquire_memory: this call could return NULL
codec2-1.2.0/src/c2dec.c:236:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/c2dec.c:237:12: branch_true: ...to here
codec2-1.2.0/src/c2dec.c:239:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/c2dec.c:242:7: branch_false: ...to here
codec2-1.2.0/src/c2dec.c:242:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/c2dec.c:242:6: branch_false: ...to here
codec2-1.2.0/src/c2dec.c:246:10: branch_true: following ‘true’ branch (when ‘ret != 0’)...
codec2-1.2.0/src/c2dec.c:250:8: branch_true: ...to here
codec2-1.2.0/src/c2dec.c:250:8: branch_false: following ‘false’ branch (when ‘error_mode != 1’)...
codec2-1.2.0/src/c2dec.c:306:8: branch_false: ...to here
codec2-1.2.0/src/c2dec.c:306:8: branch_false: following ‘false’ branch (when ‘fber’ is NULL)...
codec2-1.2.0/src/c2dec.c:313:7: branch_false: ...to here
codec2-1.2.0/src/c2dec.c:315:8: branch_true: following ‘true’ branch...
codec2-1.2.0/src/c2dec.c:320:7: branch_true: ...to here
codec2-1.2.0/src/c2dec.c:320:7: danger: argument 1 (‘bits’) from [(9)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/8) could be NULL where non-null expected
# 318| bit = 7;
# 319| byte = 0;
# 320|-> memset(bits, 0, nbyte);
# 321| for (i = 0; i < nbit; i++) {
# 322| bits[byte] |= ((softdec_bits[i] < 0.0) << bit);
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/c2dec.c:322:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘softdec_bits’
codec2-1.2.0/src/c2dec.c:90:6: branch_false: following ‘false’ branch (when ‘argc > 3’)...
codec2-1.2.0/src/c2dec.c:92:7: branch_false: ...to here
codec2-1.2.0/src/c2dec.c:92:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/c2dec.c:93:5: branch_true: ...to here
codec2-1.2.0/src/c2dec.c:100:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/c2dec.c:101:5: branch_true: ...to here
codec2-1.2.0/src/c2dec.c:111:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/c2dec.c:169:27: acquire_memory: this call could return NULL
codec2-1.2.0/src/c2dec.c:236:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/c2dec.c:237:12: branch_true: ...to here
codec2-1.2.0/src/c2dec.c:239:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/c2dec.c:242:7: branch_false: ...to here
codec2-1.2.0/src/c2dec.c:242:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/c2dec.c:242:6: branch_false: ...to here
codec2-1.2.0/src/c2dec.c:246:10: branch_true: following ‘true’ branch (when ‘ret != 0’)...
codec2-1.2.0/src/c2dec.c:250:8: branch_true: ...to here
codec2-1.2.0/src/c2dec.c:250:8: branch_false: following ‘false’ branch (when ‘error_mode != 1’)...
codec2-1.2.0/src/c2dec.c:306:8: branch_false: ...to here
codec2-1.2.0/src/c2dec.c:306:8: branch_false: following ‘false’ branch (when ‘fber’ is NULL)...
codec2-1.2.0/src/c2dec.c:313:7: branch_false: ...to here
codec2-1.2.0/src/c2dec.c:315:8: branch_true: following ‘true’ branch...
codec2-1.2.0/src/c2dec.c:320:7: branch_true: ...to here
codec2-1.2.0/src/c2dec.c:321:19: branch_true: following ‘true’ branch...
codec2-1.2.0/src/c2dec.c:322:9: branch_true: ...to here
codec2-1.2.0/src/c2dec.c:322:25: danger: ‘softdec_bits + (long unsigned int)i * 4’ could be NULL: unchecked value from [(9)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/8)
# 320| memset(bits, 0, nbyte);
# 321| for (i = 0; i < nbit; i++) {
# 322|-> bits[byte] |= ((softdec_bits[i] < 0.0) << bit);
# 323| bit--;
# 324| if (bit < 0) {
Error: GCC_ANALYZER_WARNING (CWE-775):
codec2-1.2.0/src/c2sim.c:312:11: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&file_name, "rb")’
codec2-1.2.0/src/c2sim.c:179:6: branch_false: following ‘false’ branch (when ‘argc > 1’)...
codec2-1.2.0/src/c2sim.c:179:6: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:186:8: branch_false: following ‘false’ branch (when ‘opt != -1’)...
codec2-1.2.0/src/c2sim.c:187:5: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:189:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:195:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:195:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:201:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:202:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:203:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:205:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:208:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:217:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:217:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:226:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:226:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:233:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:233:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:237:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:237:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:256:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:256:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:263:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:263:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:269:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:269:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:275:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:275:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:281:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:281:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:287:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:287:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:294:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:294:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:296:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:296:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:299:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:299:19: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/c2sim.c:303:49: branch_true: ...to here
codec2-1.2.0/src/c2sim.c:307:22: acquire_resource: opened here
codec2-1.2.0/src/c2sim.c:307:14: branch_false: following ‘false’ branch...
codec2-1.2.0/src/c2sim.c:312:11: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:312:11: danger: ‘fopen(&file_name, "rb")’ leaks here; was opened at [(43)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/42)
# 310| exit(1);
# 311| }
# 312|-> sprintf(file_name, "%s_hm.out", optarg);
# 313| fprintf(stderr, " %s", file_name);
# 314| if ((fhm = fopen(file_name, "rb")) == NULL) {
Error: GCC_ANALYZER_WARNING (CWE-401):
codec2-1.2.0/src/c2sim.c:312:11: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&file_name, "rb")’
codec2-1.2.0/src/c2sim.c:179:6: branch_false: following ‘false’ branch (when ‘argc > 1’)...
codec2-1.2.0/src/c2sim.c:179:6: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:186:8: branch_false: following ‘false’ branch (when ‘opt != -1’)...
codec2-1.2.0/src/c2sim.c:187:5: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:189:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:195:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:195:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:201:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:202:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:203:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:205:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:208:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:217:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:217:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:226:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:226:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:233:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:233:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:237:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:237:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:256:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:256:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:263:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:263:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:269:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:269:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:275:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:275:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:281:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:281:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:287:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:287:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:294:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:294:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:296:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:296:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:299:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:299:19: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/c2sim.c:303:49: branch_true: ...to here
codec2-1.2.0/src/c2sim.c:307:22: acquire_memory: allocated here
codec2-1.2.0/src/c2sim.c:307:14: branch_false: following ‘false’ branch...
codec2-1.2.0/src/c2sim.c:312:11: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:312:11: danger: ‘fopen(&file_name, "rb")’ leaks here; was allocated at [(43)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/42)
# 310| exit(1);
# 311| }
# 312|-> sprintf(file_name, "%s_hm.out", optarg);
# 313| fprintf(stderr, " %s", file_name);
# 314| if ((fhm = fopen(file_name, "rb")) == NULL) {
Error: GCC_ANALYZER_WARNING (CWE-775):
codec2-1.2.0/src/c2sim.c:319:11: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&file_name, "rb")’
codec2-1.2.0/src/c2sim.c:179:6: branch_false: following ‘false’ branch (when ‘argc > 1’)...
codec2-1.2.0/src/c2sim.c:179:6: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:186:8: branch_false: following ‘false’ branch (when ‘opt != -1’)...
codec2-1.2.0/src/c2sim.c:187:5: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:189:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:195:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:195:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:201:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:202:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:203:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:205:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:208:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:217:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:217:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:226:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:226:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:233:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:233:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:237:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:237:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:256:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:256:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:263:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:263:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:269:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:269:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:275:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:275:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:281:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:281:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:287:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:287:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:294:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:294:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:296:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:296:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:299:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:299:19: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/c2sim.c:303:49: branch_true: ...to here
codec2-1.2.0/src/c2sim.c:307:14: branch_false: following ‘false’ branch...
codec2-1.2.0/src/c2sim.c:312:11: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:314:22: acquire_resource: opened here
codec2-1.2.0/src/c2sim.c:314:14: branch_false: following ‘false’ branch...
codec2-1.2.0/src/c2sim.c:319:11: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:319:11: danger: ‘fopen(&file_name, "rb")’ leaks here; was opened at [(45)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/44)
# 317| exit(1);
# 318| }
# 319|-> sprintf(file_name, "%s_Wo.out", optarg);
# 320| fprintf(stderr, " %s\n", file_name);
# 321| if ((fWo = fopen(file_name, "rb")) == NULL) {
Error: GCC_ANALYZER_WARNING (CWE-401):
codec2-1.2.0/src/c2sim.c:319:11: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&file_name, "rb")’
codec2-1.2.0/src/c2sim.c:179:6: branch_false: following ‘false’ branch (when ‘argc > 1’)...
codec2-1.2.0/src/c2sim.c:179:6: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:186:8: branch_false: following ‘false’ branch (when ‘opt != -1’)...
codec2-1.2.0/src/c2sim.c:187:5: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:189:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:195:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:195:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:201:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:202:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:203:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:201:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:205:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:208:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:217:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:217:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:226:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:226:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:233:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:233:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:237:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:237:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:256:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:256:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:263:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:263:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:269:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:269:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:275:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:275:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:281:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:281:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:287:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:287:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:294:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:294:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:296:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:296:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/c2sim.c:299:20: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:299:19: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/c2sim.c:303:49: branch_true: ...to here
codec2-1.2.0/src/c2sim.c:307:14: branch_false: following ‘false’ branch...
codec2-1.2.0/src/c2sim.c:312:11: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:314:22: acquire_memory: allocated here
codec2-1.2.0/src/c2sim.c:314:14: branch_false: following ‘false’ branch...
codec2-1.2.0/src/c2sim.c:319:11: branch_false: ...to here
codec2-1.2.0/src/c2sim.c:319:11: danger: ‘fopen(&file_name, "rb")’ leaks here; was allocated at [(45)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/44)
# 317| exit(1);
# 318| }
# 319|-> sprintf(file_name, "%s_Wo.out", optarg);
# 320| fprintf(stderr, " %s\n", file_name);
# 321| if ((fWo = fopen(file_name, "rb")) == NULL) {
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/c2sim.c:671: warning[uninitvar]: Uninitialized variable: buf
# 669| buf[i] = Sn[m_pitch / 2 - n_5_ms + i];
# 670| }
# 671|-> fwrite(buf, n_10_ms, sizeof(short), ften_ms_centre);
# 672| }
# 673|
Error: COMPILER_WARNING (CWE-563):
codec2-1.2.0/src/c2sim.c: scope_hint: In function ‘main’
codec2-1.2.0/src/c2sim.c:706:13: warning[-Wunused-variable]: unused variable ‘ret’
# 706 | int ret = fscanf(fvoicing, "%d\n", &model.voiced);
# | ^~~
# 704|
# 705| if (hand_voicing) {
# 706|-> int ret = fscanf(fvoicing, "%d\n", &model.voiced);
# 707| assert(ret == 1);
# 708| }
Error: COMPILER_WARNING (CWE-563):
codec2-1.2.0/src/c2sim.c:789:11: warning[-Wunused-variable]: unused variable ‘ret’
# 789 | int ret = fread(model.A, sizeof(float), MAX_AMP, fam);
# | ^~~
# 787|
# 788| if (amread) {
# 789|-> int ret = fread(model.A, sizeof(float), MAX_AMP, fam);
# 790| assert(ret == MAX_AMP);
# 791| }
Error: COMPILER_WARNING (CWE-563):
codec2-1.2.0/src/c2sim.c:794:11: warning[-Wunused-variable]: unused variable ‘ret’
# 794 | int ret = fread(&model.Wo, sizeof(float), 1, fWo);
# | ^~~
# 792|
# 793| if (Woread) {
# 794|-> int ret = fread(&model.Wo, sizeof(float), 1, fWo);
# 795| model.L = floor(PI / model.Wo);
# 796| assert(ret == 1);
Error: COMPILER_WARNING (CWE-563):
codec2-1.2.0/src/c2sim.c:1051:17: warning[-Wunused-variable]: unused variable ‘ret’
# 1051 | int ret = fread(Aw, sizeof(COMP), FFT_ENC, faw);
# | ^~~
# 1049|
# 1050| if (awread) {
# 1051|-> int ret = fread(Aw, sizeof(COMP), FFT_ENC, faw);
# 1052| assert(ret == FFT_ENC);
# 1053| }
Error: COMPILER_WARNING (CWE-563):
codec2-1.2.0/src/c2sim.c:1058:17: warning[-Wunused-variable]: unused variable ‘ret’
# 1058 | int ret = fread(H, sizeof(COMP), MAX_AMP, fhm);
# | ^~~
# 1056|
# 1057| if (hmread) {
# 1058|-> int ret = fread(H, sizeof(COMP), MAX_AMP, fhm);
# 1059| assert(ret == MAX_AMP);
# 1060| } else {
Error: GCC_ANALYZER_WARNING (CWE-401):
codec2-1.2.0/src/codec2.c:272:1: warning[-Wanalyzer-malloc-leak]: leak of ‘c2’
codec2-1.2.0/src/codec2.c:116:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/codec2.c:126:25: branch_true: ...to here
codec2-1.2.0/src/codec2.c:126:25: acquire_memory: allocated here
codec2-1.2.0/src/codec2.c:127:6: branch_false: following ‘false’ branch (when ‘c2’ is non-NULL)...
codec2-1.2.0/src/codec2.c:129:3: branch_false: ...to here
codec2-1.2.0/src/codec2.c:139:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/codec2.c:139:6: branch_true: ...to here
codec2-1.2.0/src/codec2.c:272:1: danger: ‘c2’ leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
# 270|
# 271| return c2;
# 272|-> }
# 273|
# 274| /*---------------------------------------------------------------------------*\
Error: COMPILER_WARNING (CWE-563):
codec2-1.2.0/src/codec2.c: scope_hint: In function ‘codec2_load_codebook’
codec2-1.2.0/src/codec2.c:1888:7: warning[-Wunused-variable]: unused variable ‘nread’
# 1888 | int nread =
# | ^~~~~
# 1886| // newamp1vq_cb[num].k, newamp1vq_cb[num].m);
# 1887| float tmp[newamp1vq_cb[num].k * newamp1vq_cb[num].m];
# 1888|-> int nread =
# 1889| fread(tmp, sizeof(float), newamp1vq_cb[num].k * newamp1vq_cb[num].m, f);
# 1890| float *p = (float *)newamp1vq_cb[num].cb;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/codec2_fifo.c:59:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘fifo’
codec2-1.2.0/src/codec2_fifo.c:56:25: acquire_memory: this call could return NULL
codec2-1.2.0/src/codec2_fifo.c:59:3: danger: ‘fifo’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
# 57| assert(fifo != NULL);
# 58|
# 59|-> fifo->buf = buf;
# 60| fifo->pin = fifo->buf;
# 61| fifo->pout = fifo->buf;
Error: CPPCHECK_WARNING (CWE-416):
codec2-1.2.0/src/debug_alloc.h:54: error[deallocuse]: Dereferencing 'ptr' after it is deallocated / released
# 52| static inline void DEBUG_FREE(const char *func, void *ptr) {
# 53| codec2_free(ptr);
# 54|-> fprintf(stderr, "FREE: %s %p\n", func, ptr);
# 55| }
# 56|
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/deframer.c:100:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘inbuf’ where non-null expected
codec2-1.2.0/src/deframer.c:45:6: branch_false: following ‘false’ branch (when ‘argc > 4’)...
codec2-1.2.0/src/deframer.c:56:7: branch_false: ...to here
codec2-1.2.0/src/deframer.c:56:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/deframer.c:57:5: branch_true: ...to here
codec2-1.2.0/src/deframer.c:65:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/deframer.c:66:5: branch_true: ...to here
codec2-1.2.0/src/deframer.c:86:19: branch_false: following ‘false’ branch (when ‘uwsize <= i’)...
codec2-1.2.0/src/deframer.c:87:3: branch_false: ...to here
codec2-1.2.0/src/deframer.c:98:20: acquire_memory: this call could return NULL
codec2-1.2.0/src/deframer.c:100:3: danger: argument 1 (‘inbuf’) from [(9)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/8) could be NULL where non-null expected
# 98| uint8_t *inbuf = malloc(2 * nelement * framedsize);
# 99| assert(inbuf != NULL);
# 100|-> memset(inbuf, 0, 2 * nelement * framedsize);
# 101|
# 102| /* main loop */
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fdmdv.c:88:39: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc((long unsigned int)(Nc * 8) * 4)’
codec2-1.2.0/src/fdmdv.c:80:6: branch_false: following ‘false’ branch (when ‘f’ is non-NULL)...
codec2-1.2.0/src/fdmdv.c:82:3: branch_false: ...to here
codec2-1.2.0/src/fdmdv.c:86:32: acquire_memory: this call could return NULL
codec2-1.2.0/src/fdmdv.c:88:15: branch_true: following ‘true’ branch...
codec2-1.2.0/src/fdmdv.c:88:58: branch_true: ...to here
codec2-1.2.0/src/fdmdv.c:88:39: danger: ‘malloc((long unsigned int)(Nc * 8) * 4) + (long unsigned int)i * 4’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
# 86| f->rx_test_bits_mem = (int *)MALLOC(sizeof(int) * f->ntest_bits);
# 87| assert(f->rx_test_bits_mem != NULL);
# 88|-> for (i = 0; i < f->ntest_bits; i++) f->rx_test_bits_mem[i] = 0;
# 89| assert((sizeof(test_bits) / sizeof(int)) >= f->ntest_bits);
# 90|
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/fdmdv.c:809:41: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘pilot[i].real’
codec2-1.2.0/src/fdmdv.c:1586:6: enter_function: entry to ‘fdmdv_demod’
codec2-1.2.0/src/fdmdv.c:1609:17: call_function: calling ‘rx_est_freq_offset’ from ‘fdmdv_demod’
# 807| #ifndef FDV_ARM_MATH
# 808| for (i = 0, j = NPILOTBASEBAND - nin; i < nin; i++, j++) {
# 809|-> f->pilot_baseband1[j] = cmult(rx_fdm[i], pilot[i]);
# 810| f->pilot_baseband2[j] = cmult(rx_fdm[i], prev_pilot[i]);
# 811| }
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/fdmdv.c:1021:7: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*inpCmplx’
codec2-1.2.0/src/fdmdv.c:1100:6: enter_function: entry to ‘down_convert_and_rx_filter’
codec2-1.2.0/src/fdmdv.c:1124:15: branch_true: following ‘true’ branch (when ‘c <= Nc’)...
codec2-1.2.0/src/fdmdv.c:1147:31: branch_true: ...to here
codec2-1.2.0/src/fdmdv.c:1164:18: branch_false: following ‘false’ branch (when ‘i > 1159’)...
codec2-1.2.0/src/fdmdv.c:1164:18: branch_false: ...to here
codec2-1.2.0/src/fdmdv.c:1185:7: call_function: calling ‘fir_filter2’ from ‘down_convert_and_rx_filter’
# 1019| c1 = *coeffPtr;
# 1020|
# 1021|-> m1 = inpCmplx[0];
# 1022| m2 = inpCmplx[1];
# 1023|
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/fdmdv.c:1064:7: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*inpCmplx’
codec2-1.2.0/src/fdmdv.c:1100:6: enter_function: entry to ‘down_convert_and_rx_filter’
codec2-1.2.0/src/fdmdv.c:1124:15: branch_true: following ‘true’ branch (when ‘c <= Nc’)...
codec2-1.2.0/src/fdmdv.c:1147:31: branch_true: ...to here
codec2-1.2.0/src/fdmdv.c:1164:18: branch_false: following ‘false’ branch (when ‘i > 1159’)...
codec2-1.2.0/src/fdmdv.c:1164:18: branch_false: ...to here
codec2-1.2.0/src/fdmdv.c:1185:7: call_function: calling ‘fir_filter2’ from ‘down_convert_and_rx_filter’
# 1062| c1 = *coeffPtr;
# 1063|
# 1064|-> m1 = inpCmplx[0];
# 1065| m2 = inpCmplx[1];
# 1066|
Error: CPPCHECK_WARNING (CWE-786):
codec2-1.2.0/src/fdmdv.c:1763: error[negativeIndex]: Array 'in8k[0]' accessed at index -24, which is out of bounds.
# 1761| /* update filter memory */
# 1762|
# 1763|-> for (i = -(FDMDV_OS_TAPS_8K); i < 0; i++) in8k[i] = in8k[i + n8k];
# 1764| }
# 1765|
Error: CPPCHECK_WARNING (CWE-786):
codec2-1.2.0/src/fdmdv.c:1788: error[negativeIndex]: Array 'in8k[0]' accessed at index -24, which is out of bounds.
# 1786| /* update filter memory */
# 1787|
# 1788|-> for (i = -(FDMDV_OS_TAPS_8K); i < 0; i++) in8k[i] = in8k[i + n8k];
# 1789| }
# 1790|
Error: CPPCHECK_WARNING (CWE-786):
codec2-1.2.0/src/fdmdv.c:1821: error[negativeIndex]: Array 'in16k[0]' accessed at index -48, which is out of bounds.
# 1819| /* update filter memory */
# 1820|
# 1821|-> for (i = -FDMDV_OS_TAPS_16K; i < 0; i++) in16k[i] = in16k[i + n * FDMDV_OS];
# 1822| }
# 1823|
Error: CPPCHECK_WARNING (CWE-786):
codec2-1.2.0/src/fdmdv.c:1837: error[negativeIndex]: Array 'in16k[0]' accessed at index -48, which is out of bounds.
# 1835| /* update filter memory */
# 1836|
# 1837|-> for (i = -FDMDV_OS_TAPS_16K; i < 0; i++) in16k[i] = in16k[i + n * FDMDV_OS];
# 1838| }
# 1839|
Error: CPPCHECK_WARNING (CWE-786):
codec2-1.2.0/src/fdmdv.c:1868: error[negativeIndex]: Array 'in8k[0]' accessed at index -8, which is out of bounds.
# 1866| /* update filter memory */
# 1867|
# 1868|-> for (i = -FDMDV_OS_TAPS_48_8K; i < 0; i++) in8k[i] = in8k[i + n];
# 1869| }
# 1870|
Error: CPPCHECK_WARNING (CWE-786):
codec2-1.2.0/src/fdmdv.c:1886: error[negativeIndex]: Array 'in8k[0]' accessed at index -8, which is out of bounds.
# 1884| /* update filter memory */
# 1885|
# 1886|-> for (i = -FDMDV_OS_TAPS_48_8K; i < 0; i++) in8k[i] = in8k[i + n];
# 1887| }
# 1888|
Error: CPPCHECK_WARNING (CWE-786):
codec2-1.2.0/src/fdmdv.c:1910: error[negativeIndex]: Array 'in48k[0]' accessed at index -47, which is out of bounds.
# 1908| out8k[i] = 0.0;
# 1909| for (j = 0; j < FDMDV_OS_TAPS_48K; j++)
# 1910|-> out8k[i] += fdmdv_os_filter48[j] * in48k[i * FDMDV_OS_48 - j];
# 1911| }
# 1912|
Error: CPPCHECK_WARNING (CWE-786):
codec2-1.2.0/src/fdmdv.c:1916: error[negativeIndex]: Array 'in48k[0]' accessed at index -48, which is out of bounds.
# 1914|
# 1915| for (i = -FDMDV_OS_TAPS_48K; i < 0; i++)
# 1916|-> in48k[i] = in48k[i + n * FDMDV_OS_48];
# 1917| }
# 1918|
Error: CPPCHECK_WARNING (CWE-786):
codec2-1.2.0/src/fdmdv.c:1926: error[negativeIndex]: Array 'in48k[0]' accessed at index -47, which is out of bounds.
# 1924| acc = 0.0;
# 1925| for (j = 0; j < FDMDV_OS_TAPS_48K; j++)
# 1926|-> acc += fdmdv_os_filter48[j] * in48k[i * FDMDV_OS_48 - j];
# 1927| out8k[i] = acc;
# 1928| }
Error: CPPCHECK_WARNING (CWE-786):
codec2-1.2.0/src/fdmdv.c:1933: error[negativeIndex]: Array 'in48k[0]' accessed at index -48, which is out of bounds.
# 1931|
# 1932| for (i = -FDMDV_OS_TAPS_48K; i < 0; i++)
# 1933|-> in48k[i] = in48k[i + n * FDMDV_OS_48];
# 1934| }
# 1935|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fdmdv_demod.c:167: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rx_symbols_log
# 165|
# 166| for (c = 0; c < Nc + 1; c++)
# 167|-> rx_symbols_log[f * (Nc + 1) + c] = stats.rx_symbols[0][c];
# 168| foff_log[f] = stats.foff;
# 169| rx_timing_log[f] = stats.rx_timing;
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/fdmdv_get_test_bits.c:100:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘packed_bits’ where non-null expected
codec2-1.2.0/src/fdmdv_get_test_bits.c:49:6: branch_false: following ‘false’ branch (when ‘argc > 2’)...
codec2-1.2.0/src/fdmdv_get_test_bits.c:55:7: branch_false: ...to here
codec2-1.2.0/src/fdmdv_get_test_bits.c:55:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/fdmdv_get_test_bits.c:56:5: branch_true: ...to here
codec2-1.2.0/src/fdmdv_get_test_bits.c:85:25: acquire_memory: this call could return NULL
codec2-1.2.0/src/fdmdv_get_test_bits.c:92:15: branch_true: following ‘true’ branch (when ‘n < nCodecFrames’)...
codec2-1.2.0/src/fdmdv_get_test_bits.c:93:5: branch_true: ...to here
codec2-1.2.0/src/fdmdv_get_test_bits.c:100:5: danger: argument 1 (‘packed_bits’) from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
# 98| bit = 7;
# 99| byte = 0;
# 100|-> memset(packed_bits, 0, bytes_per_codec_frame);
# 101| for (i = 0; i < bits_per_codec_frame; i++) {
# 102| packed_bits[byte] |= (tx_bits[i] << bit);
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fdmdv_put_test_bits.c:107:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘rx_bits’
codec2-1.2.0/src/fdmdv_put_test_bits.c:52:6: branch_false: following ‘false’ branch (when ‘argc > 1’)...
codec2-1.2.0/src/fdmdv_put_test_bits.c:58:7: branch_false: ...to here
codec2-1.2.0/src/fdmdv_put_test_bits.c:58:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/fdmdv_put_test_bits.c:59:5: branch_true: ...to here
codec2-1.2.0/src/fdmdv_put_test_bits.c:88:20: acquire_memory: this call could return NULL
codec2-1.2.0/src/fdmdv_put_test_bits.c:100:10: branch_true: following ‘true’ branch...
codec2-1.2.0/src/fdmdv_put_test_bits.c:100:10: branch_true: ...to here
codec2-1.2.0/src/fdmdv_put_test_bits.c:106:17: branch_true: following ‘true’ branch (when ‘i < bits_per_codec_frame’)...
codec2-1.2.0/src/fdmdv_put_test_bits.c:107:32: branch_true: ...to here
codec2-1.2.0/src/fdmdv_put_test_bits.c:107:7: danger: ‘rx_bits + (long unsigned int)i * 4’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
# 105| byte = 0;
# 106| for (i = 0; i < bits_per_codec_frame; i++) {
# 107|-> rx_bits[i] = (packed_bits[byte] >> bit) & 0x1;
# 108| // printf("%d 0x%x %d\n", i, packed_bits[byte], rx_bits[i]);
# 109| bit--;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fdmdv_put_test_bits.c:107:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘packed_bits’
codec2-1.2.0/src/fdmdv_put_test_bits.c:52:6: branch_false: following ‘false’ branch (when ‘argc > 1’)...
codec2-1.2.0/src/fdmdv_put_test_bits.c:58:7: branch_false: ...to here
codec2-1.2.0/src/fdmdv_put_test_bits.c:58:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/fdmdv_put_test_bits.c:59:5: branch_true: ...to here
codec2-1.2.0/src/fdmdv_put_test_bits.c:86:25: acquire_memory: this call could return NULL
codec2-1.2.0/src/fdmdv_put_test_bits.c:100:10: branch_true: following ‘true’ branch...
codec2-1.2.0/src/fdmdv_put_test_bits.c:100:10: branch_true: ...to here
codec2-1.2.0/src/fdmdv_put_test_bits.c:106:17: branch_true: following ‘true’ branch (when ‘i < bits_per_codec_frame’)...
codec2-1.2.0/src/fdmdv_put_test_bits.c:107:32: branch_true: ...to here
codec2-1.2.0/src/fdmdv_put_test_bits.c:107:21: danger: ‘packed_bits + (sizetype)byte’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
# 105| byte = 0;
# 106| for (i = 0; i < bits_per_codec_frame; i++) {
# 107|-> rx_bits[i] = (packed_bits[byte] >> bit) & 0x1;
# 108| // printf("%d 0x%x %d\n", i, packed_bits[byte], rx_bits[i]);
# 109| bit--;
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/filter.c:53:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*filter.cSamples’ where non-null expected
codec2-1.2.0/src/filter.c:52:39: acquire_memory: this call could return NULL
codec2-1.2.0/src/filter.c:53:3: danger: argument 1 (‘malloc((long unsigned int)taps * 8)’) from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 51| filter->cpxCoefs = NULL;
# 52| filter->cSamples = (complex float *)MALLOC(taps * sizeof(complex float));
# 53|-> memset(filter->cSamples, 0, taps * sizeof(complex float));
# 54| filter->ptcSamp = filter->cSamples;
# 55| filter->nTaps = taps;
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/filter.c:122:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*filter.cBuf’ where non-null expected
codec2-1.2.0/src/filter.c:113:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/filter.c:114:20: branch_true: ...to here
codec2-1.2.0/src/filter.c:119:26: acquire_memory: this call could return NULL
codec2-1.2.0/src/filter.c:122:3: danger: argument 1 (‘*filter.cBuf’) from [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
# 120| }
# 121|
# 122|-> memcpy(filter->cBuf, cSamples, count * sizeof(complex float));
# 123| nOut = 0;
# 124|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fmfsk.c:204: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rx_filt
# 202| t += oldsamps[j];
# 203| }
# 204|-> rx_filt[i] = t;
# 205| }
# 206|
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fmfsk.c:204:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘rx_filt’
codec2-1.2.0/src/fmfsk.c:195:20: acquire_memory: this call could return NULL
codec2-1.2.0/src/fmfsk.c:198:15: branch_true: following ‘true’ branch...
codec2-1.2.0/src/fmfsk.c:198:15: branch_true: ...to here
codec2-1.2.0/src/fmfsk.c:201:17: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fmfsk.c:204:12: branch_false: ...to here
codec2-1.2.0/src/fmfsk.c:204:5: danger: ‘rx_filt + (long unsigned int)i * 4’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
# 202| t += oldsamps[j];
# 203| }
# 204|-> rx_filt[i] = t;
# 205| }
# 206|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fmfsk.c:227: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rx_filt
# 225| for (i = 0; i < (nsym + 1) * Ts; i++) {
# 226| /* Apply non-linearity */
# 227|-> t = rx_filt[i] * rx_filt[i];
# 228|
# 229| /* Shift Rs/2 down to DC and accumulate */
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/fmfsk.c:271:13: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
codec2-1.2.0/src/fmfsk.c:198:15: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fmfsk.c:219:34: branch_false: ...to here
codec2-1.2.0/src/fmfsk.c:225:15: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fmfsk.c:238:20: branch_false: ...to here
codec2-1.2.0/src/fmfsk.c:248:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fmfsk.c:254:19: branch_false: ...to here
codec2-1.2.0/src/fmfsk.c:269:15: branch_true: following ‘true’ branch (when ‘i < nsym’)...
codec2-1.2.0/src/fmfsk.c:271:37: branch_true: ...to here
codec2-1.2.0/src/fmfsk.c:271:13: danger: use of uninitialized value ‘*<unknown>’ here
# 269| for (i = 0; i < nsym; i++) {
# 270| /* Sample a filtered value */
# 271|-> currv = rx_filt[sample_offset + (i * Ts)];
# 272| modem_probe_samp_f("t_symsamp", &currv, 1);
# 273| mdiff = lastv - currv;
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/framer.c:91: warning[uninitvar]: Uninitialized variable: uw
# 89| uint8_t frame[framesize];
# 90| while (fread(frame, sizeof(uint8_t), framesize, fin) == framesize) {
# 91|-> fwrite(uw, sizeof(uint8_t), uwsize, fout);
# 92| fwrite(frame, sizeof(uint8_t), framesize, fout);
# 93| }
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/freedv_2020.c:83:5: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘vq_type’
codec2-1.2.0/src/freedv_2020.c:81:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/freedv_2020.c:82:5: branch_true: ...to here
codec2-1.2.0/src/freedv_2020.c:83:5: danger: use of uninitialized value ‘vq_type’ here
# 81| if (f->verbose) {
# 82| fprintf(stderr, "f->mode = %d\n", f->mode);
# 83|-> fprintf(stderr, "vq_type = %d\n", vq_type);
# 84| fprintf(stderr, "ldpc_data_bits_per_frame = %d\n",
# 85| f->ldpc->ldpc_data_bits_per_frame);
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/freedv_2020.c:105:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*f.codeword_symbols’
codec2-1.2.0/src/freedv_2020.c:81:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/freedv_2020.c:98:33: branch_false: ...to here
codec2-1.2.0/src/freedv_2020.c:98:33: acquire_memory: this call could return NULL
codec2-1.2.0/src/freedv_2020.c:104:19: branch_true: following ‘true’ branch (when ‘i < coded_syms_per_frame’)...
codec2-1.2.0/src/freedv_2020.c:105:24: branch_true: ...to here
codec2-1.2.0/src/freedv_2020.c:105:5: danger: ‘malloc((long unsigned int)coded_syms_per_frame * 8) + (long unsigned int)i * 8’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
# 103|
# 104| for (int i = 0; i < coded_syms_per_frame; i++) {
# 105|-> f->codeword_symbols[i].real = 0.0f;
# 106| f->codeword_symbols[i].imag = 0.0f;
# 107| f->codeword_amps[i] = 0.0f;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/freedv_2020.c:107:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*f.codeword_amps’
codec2-1.2.0/src/freedv_2020.c:81:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/freedv_2020.c:98:33: branch_false: ...to here
codec2-1.2.0/src/freedv_2020.c:101:31: acquire_memory: this call could return NULL
codec2-1.2.0/src/freedv_2020.c:104:19: branch_true: following ‘true’ branch (when ‘i < coded_syms_per_frame’)...
codec2-1.2.0/src/freedv_2020.c:105:24: branch_true: ...to here
codec2-1.2.0/src/freedv_2020.c:107:5: danger: ‘malloc((long unsigned int)coded_syms_per_frame * 4) + (long unsigned int)i * 4’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/4)
# 105| f->codeword_symbols[i].real = 0.0f;
# 106| f->codeword_symbols[i].imag = 0.0f;
# 107|-> f->codeword_amps[i] = 0.0f;
# 108| }
# 109|
Error: COMPILER_WARNING (CWE-563):
codec2-1.2.0/src/freedv_2020.c: scope_hint: In function ‘freedv_2020x_open’
codec2-1.2.0/src/freedv_2020.c:127:7: warning[-Wunused-variable]: unused variable ‘nout_max’
# 127 | int nout_max = 2 * freedv_get_n_max_modem_samples(f);
# | ^~~~~~~~
# 125| // make sure we have enough storage for worst case nin with passthrough, in
# 126| // 2020 we oversample the 8 kHz input Rx audio to 16 kHz
# 127|-> int nout_max = 2 * freedv_get_n_max_modem_samples(f);
# 128| assert(nout_max <= freedv_get_n_max_speech_samples(f));
# 129|
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/freedv_2020.c:130:15: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘vq_type’
codec2-1.2.0/src/freedv_2020.c:81:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/freedv_2020.c:98:33: branch_false: ...to here
codec2-1.2.0/src/freedv_2020.c:104:19: branch_false: following ‘false’ branch (when ‘i >= coded_syms_per_frame’)...
codec2-1.2.0/src/freedv_2020.c:110:26: branch_false: ...to here
codec2-1.2.0/src/freedv_2020.c:130:15: danger: use of uninitialized value ‘vq_type’ here
# 128| assert(nout_max <= freedv_get_n_max_speech_samples(f));
# 129|
# 130|-> f->lpcnet = lpcnet_freedv_create(vq_type);
# 131| assert(f->lpcnet != NULL);
# 132| f->codec2 = NULL;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/freedv_700.c:148:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*f.rx_syms’
codec2-1.2.0/src/freedv_700.c:143:24: acquire_memory: this call could return NULL
codec2-1.2.0/src/freedv_700.c:147:19: branch_true: following ‘true’ branch (when ‘i < Nsymsperpacket’)...
codec2-1.2.0/src/freedv_700.c:148:36: branch_true: ...to here
codec2-1.2.0/src/freedv_700.c:148:26: danger: ‘malloc((long unsigned int)Nsymsperpacket * 8) + (long unsigned int)i * 8’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
# 146| assert(f->rx_amps != NULL);
# 147| for (int i = 0; i < Nsymsperpacket; i++) {
# 148|-> f->rx_syms[i].real = f->rx_syms[i].imag = 0.0;
# 149| f->rx_amps[i] = 0.0;
# 150| }
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/freedv_700.c:149:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*f.rx_amps’
codec2-1.2.0/src/freedv_700.c:145:25: acquire_memory: this call could return NULL
codec2-1.2.0/src/freedv_700.c:147:19: branch_true: following ‘true’ branch (when ‘i < Nsymsperpacket’)...
codec2-1.2.0/src/freedv_700.c:148:36: branch_true: ...to here
codec2-1.2.0/src/freedv_700.c:149:5: danger: ‘malloc((long unsigned int)Nsymsperpacket * 4) + (long unsigned int)i * 4’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
# 147| for (int i = 0; i < Nsymsperpacket; i++) {
# 148| f->rx_syms[i].real = f->rx_syms[i].imag = 0.0;
# 149|-> f->rx_amps[i] = 0.0;
# 150| }
# 151|
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/freedv_700.c:233:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*f.rx_syms’
codec2-1.2.0/src/freedv_700.c:228:24: acquire_memory: this call could return NULL
codec2-1.2.0/src/freedv_700.c:232:19: branch_true: following ‘true’ branch (when ‘i < Nsymsperpacket’)...
codec2-1.2.0/src/freedv_700.c:233:36: branch_true: ...to here
codec2-1.2.0/src/freedv_700.c:233:26: danger: ‘malloc((long unsigned int)Nsymsperpacket * 8) + (long unsigned int)i * 8’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
# 231| assert(f->rx_amps != NULL);
# 232| for (int i = 0; i < Nsymsperpacket; i++) {
# 233|-> f->rx_syms[i].real = f->rx_syms[i].imag = 0.0;
# 234| f->rx_amps[i] = 0.0;
# 235| }
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/freedv_700.c:234:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*f.rx_amps’
codec2-1.2.0/src/freedv_700.c:230:25: acquire_memory: this call could return NULL
codec2-1.2.0/src/freedv_700.c:232:19: branch_true: following ‘true’ branch (when ‘i < Nsymsperpacket’)...
codec2-1.2.0/src/freedv_700.c:233:36: branch_true: ...to here
codec2-1.2.0/src/freedv_700.c:234:5: danger: ‘malloc((long unsigned int)Nsymsperpacket * 4) + (long unsigned int)i * 4’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
# 232| for (int i = 0; i < Nsymsperpacket; i++) {
# 233| f->rx_syms[i].real = f->rx_syms[i].imag = 0.0;
# 234|-> f->rx_amps[i] = 0.0;
# 235| }
# 236|
Error: CPPCHECK_WARNING (CWE-415):
codec2-1.2.0/src/freedv_api.c:207: error[doubleFree]: Memory pointed to by 'ldpc' is freed twice.
# 205| FREE(freedv->codeword_symbols);
# 206| FREE(freedv->codeword_amps);
# 207|-> FREE(freedv->ldpc);
# 208| FREE(freedv->passthrough_2020);
# 209| ofdm_destroy(freedv->ofdm);
Error: CPPCHECK_WARNING (CWE-415):
codec2-1.2.0/src/freedv_api.c:228: error[doubleFree]: Memory pointed to by 'ldpc' is freed twice.
# 226| if (FDV_MODE_ACTIVE(FREEDV_MODE_FSK_LDPC, freedv->mode)) {
# 227| fsk_destroy(freedv->fsk);
# 228|-> FREE(freedv->ldpc);
# 229| FREE(freedv->frame_llr);
# 230| FREE(freedv->twoframes_llr);
Error: CPPCHECK_WARNING (CWE-415):
codec2-1.2.0/src/freedv_api.c:239: error[doubleFree]: Memory pointed to by 'rx_syms' is freed twice.
# 237| FDV_MODE_ACTIVE(FREEDV_MODE_DATAC4, freedv->mode) ||
# 238| FDV_MODE_ACTIVE(FREEDV_MODE_DATAC13, freedv->mode)) {
# 239|-> FREE(freedv->rx_syms);
# 240| FREE(freedv->rx_amps);
# 241| FREE(freedv->ldpc);
Error: CPPCHECK_WARNING (CWE-415):
codec2-1.2.0/src/freedv_api.c:240: error[doubleFree]: Memory pointed to by 'rx_amps' is freed twice.
# 238| FDV_MODE_ACTIVE(FREEDV_MODE_DATAC13, freedv->mode)) {
# 239| FREE(freedv->rx_syms);
# 240|-> FREE(freedv->rx_amps);
# 241| FREE(freedv->ldpc);
# 242| ofdm_destroy(freedv->ofdm);
Error: CPPCHECK_WARNING (CWE-415):
codec2-1.2.0/src/freedv_api.c:241: error[doubleFree]: Memory pointed to by 'ldpc' is freed twice.
# 239| FREE(freedv->rx_syms);
# 240| FREE(freedv->rx_amps);
# 241|-> FREE(freedv->ldpc);
# 242| ofdm_destroy(freedv->ofdm);
# 243| }
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/freedv_api.c:917:49: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
codec2-1.2.0/src/freedv_api.c:788:5: enter_function: entry to ‘freedv_comprx’
codec2-1.2.0/src/freedv_api.c:794:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/freedv_api.c:797:7: branch_false: ...to here
codec2-1.2.0/src/freedv_api.c:797:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/freedv_api.c:801:8: branch_false: ...to here
codec2-1.2.0/src/freedv_api.c:801:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/freedv_api.c:807:7: branch_false: ...to here
codec2-1.2.0/src/freedv_api.c:807:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/freedv_api.c:813:7: branch_false: ...to here
codec2-1.2.0/src/freedv_api.c:813:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/freedv_api.c:820:24: branch_false: ...to here
codec2-1.2.0/src/freedv_api.c:822:19: branch_false: following ‘false’ branch...
codec2-1.2.0/src/freedv_api.c:824:10: branch_false: ...to here
codec2-1.2.0/src/freedv_api.c:824:10: call_function: calling ‘freedv_bits_to_speech’ from ‘freedv_comprx’
# 915| nout = f->nin_prev / rate_factor;
# 916| for (int i = 0; i < nout; i++)
# 917|-> speech_out[i] = f->passthrough_gain * demod_in[i * rate_factor];
# 918| }
# 919| }
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/freedv_data_raw_tx.c:504: warning[uninitvar]: Uninitialized variable: sil_short
# 502| short sil_short[n];
# 503| for (int i = 0; i < n; i++) sil_short[i] = 0;
# 504|-> fwrite(sil_short, sizeof(short), n, fout);
# 505| return samples_delay;
# 506| }
Error: GCC_ANALYZER_WARNING (CWE-465):
codec2-1.2.0/src/freedv_data_rx.c:96:6: warning[-Wanalyzer-deref-before-check]: check of ‘((struct my_callback_state)*(void *)callback_state).fdataout’ for NULL after already dereferencing it
# 94| fprintf(pstate->fdataout, "%-4d", pstate->calls);
# 95|
# 96|-> if (pstate->fdataout != NULL) {
# 97| size_t i;
# 98|
Error: GCC_ANALYZER_WARNING (CWE-131):
codec2-1.2.0/src/freedv_fsk.c:44:3: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
# 42|
# 43| /* Note: fsk expects tx/rx bits as an array of uint8_ts, not ints */
# 44|-> f->tx_bits = (int *)MALLOC(f->fsk->Nbits * sizeof(uint8_t));
# 45| assert(f->tx_bits != NULL);
# 46|
Error: GCC_ANALYZER_WARNING (CWE-131):
codec2-1.2.0/src/freedv_fsk.c:78:3: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
# 76|
# 77| /* Note: fsk expects tx/rx bits as an array of uint8_ts, not ints */
# 78|-> f->tx_bits = (int *)MALLOC(f->fmfsk->nbit * sizeof(uint8_t));
# 79| assert(f->tx_bits != NULL);
# 80| f->n_nom_modem_samples = f->fmfsk->N;
Error: GCC_ANALYZER_WARNING (CWE-131):
codec2-1.2.0/src/freedv_fsk.c:107:3: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
# 105| assert(f->fsk != NULL);
# 106|
# 107|-> f->tx_bits = (int *)MALLOC(f->fsk->Nbits * sizeof(uint8_t));
# 108| assert(f->fsk != NULL);
# 109|
Error: COMPILER_WARNING (CWE-563):
codec2-1.2.0/src/freedv_fsk.c: scope_hint: In function ‘freedv_fsk_ldpc_open’
codec2-1.2.0/src/freedv_fsk.c:152:7: warning[-Wunused-variable]: unused variable ‘code_index’
# 152 | int code_index = ldpc_codes_find(adv->codename);
# | ^~~~~~~~~~
# 150|
# 151| /* set up LDPC code */
# 152|-> int code_index = ldpc_codes_find(adv->codename);
# 153| assert(code_index != -1);
# 154| f->ldpc = (struct LDPC *)MALLOC(sizeof(struct LDPC));
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/freedv_fsk.c:188:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*f.twoframes_hard’ where non-null expected
codec2-1.2.0/src/freedv_fsk.c:186:23: acquire_memory: this call could return NULL
codec2-1.2.0/src/freedv_fsk.c:188:3: danger: argument 1 (‘malloc((long unsigned int)(bits_per_frame * 2))’) from [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 186| f->twoframes_hard = MALLOC(2 * bits_per_frame);
# 187| assert(f->twoframes_hard != NULL);
# 188|-> memset(f->twoframes_hard, 0, 2 * bits_per_frame);
# 189| f->twoframes_llr = (float *)MALLOC(2 * bits_per_frame * sizeof(float));
# 190| assert(f->twoframes_llr != NULL);
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/freedv_fsk.c:191:48: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*f.twoframes_llr’
codec2-1.2.0/src/freedv_fsk.c:189:31: acquire_memory: this call could return NULL
codec2-1.2.0/src/freedv_fsk.c:191:19: branch_true: following ‘true’ branch...
codec2-1.2.0/src/freedv_fsk.c:191:64: branch_true: ...to here
codec2-1.2.0/src/freedv_fsk.c:191:48: danger: ‘malloc((long unsigned int)(bits_per_frame * 2) * 4) + (long unsigned int)i * 4’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
# 189| f->twoframes_llr = (float *)MALLOC(2 * bits_per_frame * sizeof(float));
# 190| assert(f->twoframes_llr != NULL);
# 191|-> for (int i = 0; i < 2 * bits_per_frame; i++) f->twoframes_llr[i] = 0.0;
# 192|
# 193| /* currently configured a simple frame-frame approach */
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fsk.c:93:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*fsk.hann_table + i * 4’
codec2-1.2.0/src/fsk.c:248:13: enter_function: entry to ‘fsk_create_hbr’
codec2-1.2.0/src/fsk.c:250:10: call_function: calling ‘fsk_create_core’ from ‘fsk_create_hbr’
# 91|
# 92| for (i = 0; i < Ndft; i++) {
# 93|-> fsk->hann_table[i] =
# 94| 0.5 - 0.5 * cosf(2.0 * M_PI * (float)i / (float)(Ndft - 1));
# 95| }
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fsk.c:140:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘fsk’
codec2-1.2.0/src/fsk.c:131:23: acquire_memory: this call could return NULL
codec2-1.2.0/src/fsk.c:140:3: danger: ‘fsk’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
# 138|
# 139| /* Set constant config parameters */
# 140|-> fsk->Fs = Fs;
# 141| fsk->Rs = Rs;
# 142| fsk->Ts = Fs / Rs;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fsk.c:169:54: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc((long unsigned int)((Fs / Rs * Nsym + <unknown> * 2) * M) * 8)’
codec2-1.2.0/src/fsk.c:248:13: enter_function: entry to ‘fsk_create_hbr’
codec2-1.2.0/src/fsk.c:250:10: call_function: calling ‘fsk_create_core’ from ‘fsk_create_hbr’
# 167| fsk->f_dc = (COMP *)malloc(M * fsk->Nmem * sizeof(COMP));
# 168| assert(fsk->f_dc != NULL);
# 169|-> for (i = 0; i < M * fsk->Nmem; i++) fsk->f_dc[i] = comp0();
# 170|
# 171| fsk->fft_cfg = kiss_fft_alloc(Ndft, 0, NULL, NULL);
Error: GCC_ANALYZER_WARNING:
codec2-1.2.0/src/fsk.c:173:22: warning[-Wanalyzer-imprecise-fp-arithmetic]: use of floating-point arithmetic here might yield unexpected results
codec2-1.2.0/src/fsk.c:248:13: enter_function: entry to ‘fsk_create_hbr’
codec2-1.2.0/src/fsk.c:250:10: call_function: calling ‘fsk_create_core’ from ‘fsk_create_hbr’
# 171| fsk->fft_cfg = kiss_fft_alloc(Ndft, 0, NULL, NULL);
# 172| assert(fsk->fft_cfg != NULL);
# 173|-> fsk->Sf = (float *)malloc(sizeof(float) * fsk->Ndft);
# 174| assert(fsk->Sf != NULL);
# 175| for (i = 0; i < Ndft; i++) fsk->Sf[i] = 0;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fsk.c:175:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc((long unsigned int)(int)Ndft * 4)’
codec2-1.2.0/src/fsk.c:248:13: enter_function: entry to ‘fsk_create_hbr’
codec2-1.2.0/src/fsk.c:250:10: call_function: calling ‘fsk_create_core’ from ‘fsk_create_hbr’
# 173| fsk->Sf = (float *)malloc(sizeof(float) * fsk->Ndft);
# 174| assert(fsk->Sf != NULL);
# 175|-> for (i = 0; i < Ndft; i++) fsk->Sf[i] = 0;
# 176|
# 177| #ifdef USE_HANN_TABLE
Error: GCC_ANALYZER_WARNING:
codec2-1.2.0/src/fsk.c:179:30: warning[-Wanalyzer-imprecise-fp-arithmetic]: use of floating-point arithmetic here might yield unexpected results
codec2-1.2.0/src/fsk.c:248:13: enter_function: entry to ‘fsk_create_hbr’
codec2-1.2.0/src/fsk.c:250:10: call_function: calling ‘fsk_create_core’ from ‘fsk_create_hbr’
# 177| #ifdef USE_HANN_TABLE
# 178| #ifdef GENERATE_HANN_TABLE_RUNTIME
# 179|-> fsk->hann_table = (float *)malloc(sizeof(float) * fsk->Ndft);
# 180| assert(fsk->hann_table != NULL);
# 181| fsk_generate_hann_table(fsk);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fsk.c:501: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fftin
# 499| hann = 0.5 - 0.5 * cosf(2.0 * M_PI * (float)i / (float)(fft_samps - 1));
# 500| #endif
# 501|-> fftin[i].r = hann * fsk_in[i + a].real;
# 502| fftin[i].i = hann * fsk_in[i + a].imag;
# 503| }
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fsk.c:501:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘fftin’
codec2-1.2.0/src/fsk.c:476:41: acquire_memory: this call could return NULL
codec2-1.2.0/src/fsk.c:491:15: branch_true: following ‘true’ branch...
codec2-1.2.0/src/fsk.c:492:13: branch_true: ...to here
codec2-1.2.0/src/fsk.c:495:17: branch_true: following ‘true’ branch...
codec2-1.2.0/src/fsk.c:497:14: branch_true: ...to here
codec2-1.2.0/src/fsk.c:501:7: danger: ‘fftin + i * 8’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
# 499| hann = 0.5 - 0.5 * cosf(2.0 * M_PI * (float)i / (float)(fft_samps - 1));
# 500| #endif
# 501|-> fftin[i].r = hann * fsk_in[i + a].real;
# 502| fftin[i].i = hann * fsk_in[i + a].imag;
# 503| }
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fsk.c:502: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fftin
# 500| #endif
# 501| fftin[i].r = hann * fsk_in[i + a].real;
# 502|-> fftin[i].i = hann * fsk_in[i + a].imag;
# 503| }
# 504|
Error: COMPILER_WARNING (CWE-457):
codec2-1.2.0/src/fsk.c: scope_hint: In function ‘fsk_demod_freq_est’
codec2-1.2.0/src/fsk.c:506:5: warning[-Wmaybe-uninitialized]: ‘fftin_167’ may be used uninitialized
# 506 | kiss_fft(fft_cfg, fftin, fftout);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
codec2-1.2.0/src/kiss_fftr.h:4: included_from: Included from here.
codec2-1.2.0/src/fsk.h:35: included_from: Included from here.
codec2-1.2.0/src/fsk.c:64: included_from: Included from here.
codec2-1.2.0/src/kiss_fft.h:93:6: note: by argument 2 of type ‘const struct kiss_fft_cpx *’ to ‘kiss_fft’ declared here
# 93 | void kiss_fft(kiss_fft_cfg cfg, const kiss_fft_cpx *fin, kiss_fft_cpx *fout);
# | ^~~~~~~~
# 504|
# 505| /* Do the FFT */
# 506|-> kiss_fft(fft_cfg, fftin, fftout);
# 507|
# 508| /* FFT shift to put DC bin at Ndft/2 */
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fsk.c:980:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*fsk.stats’
codec2-1.2.0/src/fsk.c:248:13: enter_function: entry to ‘fsk_create_hbr’
codec2-1.2.0/src/fsk.c:250:10: call_function: calling ‘fsk_create_core’ from ‘fsk_create_hbr’
# 978| int neyesamp = (P * 2) / neyesamp_dec;
# 979| assert(neyesamp <= MODEM_STATS_EYE_IND_MAX);
# 980|-> fsk->stats->neyesamp = neyesamp;
# 981|
# 982| int eye_traces = MODEM_STATS_ET_MAX / M;
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fsk_demod.c:319: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rawbuf
# 317| /* Demodulate! */
# 318|
# 319|-> while (fread(rawbuf, bytes_per_sample * complex_input, fsk_nin(fsk), fin) ==
# 320| fsk_nin(fsk)) {
# 321| /* convert input to a buffer of floats. Note scaling isn't really necessary
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/fsk_demod.c:319:10: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fin’ where non-null expected
codec2-1.2.0/src/fsk_demod.c:82:10: branch_true: following ‘true’ branch (when ‘o != -1’)...
codec2-1.2.0/src/fsk_demod.c:97:9: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:155:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:160:6: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:160:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:222:16: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:226:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:232:19: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:232:6: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/fsk_demod.c:235:11: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:235:11: acquire_memory: this call could return NULL
codec2-1.2.0/src/fsk_demod.c:238:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/fsk_demod.c:239:5: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:248:6: branch_true: following ‘true’ branch (when ‘user_fsk_lower == 0’)...
codec2-1.2.0/src/fsk_demod.c:249:8: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:254:6: branch_true: following ‘true’ branch (when ‘user_fsk_upper == 0’)...
codec2-1.2.0/src/fsk_demod.c:255:5: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:263:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:272:6: branch_false: following ‘false’ branch (when ‘testframe_mode == 0’)...
codec2-1.2.0/src/fsk_demod.c:291:6: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:298:6: branch_false: following ‘false’ branch (when ‘soft_dec_mode == 0’)...
codec2-1.2.0/src/fsk_demod.c:304:50: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:319:10: danger: argument 4 (‘fin’) from [(11)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/10) could be NULL where non-null expected
# 317| /* Demodulate! */
# 318|
# 319|-> while (fread(rawbuf, bytes_per_sample * complex_input, fsk_nin(fsk), fin) ==
# 320| fsk_nin(fsk)) {
# 321| /* convert input to a buffer of floats. Note scaling isn't really necessary
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fsk_demod.c:327: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: modbuf
# 325| /* S16 real input */
# 326| for (i = 0; i < fsk_nin(fsk); i++) {
# 327|-> modbuf[i].real = ((float)rawbuf[i]) / FDMDV_SCALE;
# 328| modbuf[i].imag = 0.0;
# 329| }
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fsk_demod.c:327:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘modbuf’
codec2-1.2.0/src/fsk_demod.c:82:10: branch_true: following ‘true’ branch (when ‘o != -1’)...
codec2-1.2.0/src/fsk_demod.c:97:9: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:155:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:160:6: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:160:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:222:16: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:226:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:232:19: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:232:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/fsk_demod.c:233:5: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:238:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/fsk_demod.c:239:5: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:248:6: branch_true: following ‘true’ branch (when ‘user_fsk_lower == 0’)...
codec2-1.2.0/src/fsk_demod.c:249:8: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:254:6: branch_true: following ‘true’ branch (when ‘user_fsk_upper == 0’)...
codec2-1.2.0/src/fsk_demod.c:255:5: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:263:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:272:6: branch_false: following ‘false’ branch (when ‘testframe_mode == 0’)...
codec2-1.2.0/src/fsk_demod.c:291:6: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:298:6: branch_false: following ‘false’ branch (when ‘soft_dec_mode == 0’)...
codec2-1.2.0/src/fsk_demod.c:304:50: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:309:20: acquire_memory: this call could return NULL
codec2-1.2.0/src/fsk_demod.c:319:10: branch_true: following ‘true’ branch...
codec2-1.2.0/src/fsk_demod.c:324:8: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:324:8: branch_true: following ‘true’ branch (when ‘complex_input == 1’)...
codec2-1.2.0/src/fsk_demod.c:324:8: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:326:19: branch_true: following ‘true’ branch...
codec2-1.2.0/src/fsk_demod.c:327:40: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:327:9: danger: ‘modbuf + (long unsigned int)i * 8’ could be NULL: unchecked value from [(23)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/22)
# 325| /* S16 real input */
# 326| for (i = 0; i < fsk_nin(fsk); i++) {
# 327|-> modbuf[i].real = ((float)rawbuf[i]) / FDMDV_SCALE;
# 328| modbuf[i].imag = 0.0;
# 329| }
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fsk_demod.c:327:34: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘rawbuf’
codec2-1.2.0/src/fsk_demod.c:82:10: branch_true: following ‘true’ branch (when ‘o != -1’)...
codec2-1.2.0/src/fsk_demod.c:97:9: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:155:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:160:6: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:160:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:222:16: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:226:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:232:19: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:232:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/fsk_demod.c:233:5: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:238:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/fsk_demod.c:239:5: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:248:6: branch_true: following ‘true’ branch (when ‘user_fsk_lower == 0’)...
codec2-1.2.0/src/fsk_demod.c:249:8: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:254:6: branch_true: following ‘true’ branch (when ‘user_fsk_upper == 0’)...
codec2-1.2.0/src/fsk_demod.c:255:5: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:263:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_demod.c:272:6: branch_false: following ‘false’ branch (when ‘testframe_mode == 0’)...
codec2-1.2.0/src/fsk_demod.c:291:6: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:298:6: branch_false: following ‘false’ branch (when ‘soft_dec_mode == 0’)...
codec2-1.2.0/src/fsk_demod.c:304:50: branch_false: ...to here
codec2-1.2.0/src/fsk_demod.c:307:23: acquire_memory: this call could return NULL
codec2-1.2.0/src/fsk_demod.c:319:10: branch_true: following ‘true’ branch...
codec2-1.2.0/src/fsk_demod.c:324:8: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:324:8: branch_true: following ‘true’ branch (when ‘complex_input == 1’)...
codec2-1.2.0/src/fsk_demod.c:324:8: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:326:19: branch_true: following ‘true’ branch...
codec2-1.2.0/src/fsk_demod.c:327:40: branch_true: ...to here
codec2-1.2.0/src/fsk_demod.c:327:34: danger: ‘rawbuf + (long unsigned int)i * 2’ could be NULL: unchecked value from [(23)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/22)
# 325| /* S16 real input */
# 326| for (i = 0; i < fsk_nin(fsk); i++) {
# 327|-> modbuf[i].real = ((float)rawbuf[i]) / FDMDV_SCALE;
# 328| modbuf[i].imag = 0.0;
# 329| }
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fsk_demod.c:328: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: modbuf
# 326| for (i = 0; i < fsk_nin(fsk); i++) {
# 327| modbuf[i].real = ((float)rawbuf[i]) / FDMDV_SCALE;
# 328|-> modbuf[i].imag = 0.0;
# 329| }
# 330| } else {
Error: COMPILER_WARNING (CWE-563):
codec2-1.2.0/src/fsk_demod.c: scope_hint: In function ‘main’
codec2-1.2.0/src/fsk_demod.c:348:11: warning[-Wunused-variable]: unused variable ‘bps’
# 348 | int bps = log2(fsk->mode);
# | ^~~
# 346|
# 347| if (soft_dec_mode) {
# 348|-> int bps = log2(fsk->mode);
# 349| assert(fsk->Nbits == bps * fsk->Nsym);
# 350| /* output bit LLRs */
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fsk_get_test_bits.c:82: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bitbuf
# 80| srand(158324);
# 81| for (i = 0; i < framesize; i++) {
# 82|-> bitbuf[i] = rand() & 0x1;
# 83| }
# 84|
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fsk_get_test_bits.c:82:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘bitbuf’
codec2-1.2.0/src/fsk_get_test_bits.c:46:6: branch_false: following ‘false’ branch (when ‘argc > 2’)...
codec2-1.2.0/src/fsk_get_test_bits.c:52:6: branch_false: ...to here
codec2-1.2.0/src/fsk_get_test_bits.c:52:6: branch_false: following ‘false’ branch (when ‘argc != 4’)...
codec2-1.2.0/src/fsk_get_test_bits.c:58:12: branch_false: ...to here
codec2-1.2.0/src/fsk_get_test_bits.c:60:6: branch_false: following ‘false’ branch (when ‘framecnt != 0’)...
codec2-1.2.0/src/fsk_get_test_bits.c:65:7: branch_false: ...to here
codec2-1.2.0/src/fsk_get_test_bits.c:65:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/fsk_get_test_bits.c:66:5: branch_true: ...to here
codec2-1.2.0/src/fsk_get_test_bits.c:71:6: branch_false: following ‘false’ branch (when ‘fout’ is non-NULL)...
codec2-1.2.0/src/fsk_get_test_bits.c:77:23: branch_false: ...to here
codec2-1.2.0/src/fsk_get_test_bits.c:77:23: acquire_memory: this call could return NULL
codec2-1.2.0/src/fsk_get_test_bits.c:81:15: branch_true: following ‘true’ branch (when ‘framesize > i’)...
codec2-1.2.0/src/fsk_get_test_bits.c:82:17: branch_true: ...to here
codec2-1.2.0/src/fsk_get_test_bits.c:82:5: danger: ‘bitbuf + (sizetype)i’ could be NULL: unchecked value from [(11)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/10)
# 80| srand(158324);
# 81| for (i = 0; i < framesize; i++) {
# 82|-> bitbuf[i] = rand() & 0x1;
# 83| }
# 84|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fsk_get_test_bits.c:88: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bitbuf
# 86| srand(158324);
# 87| for (i = 0; i < framecnt; i++) {
# 88|-> fwrite(bitbuf, sizeof(uint8_t), framesize, fout);
# 89| if (fout == stdout) {
# 90| fflush(fout);
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/fsk_mod.c:118:10: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fin’ where non-null expected
codec2-1.2.0/src/fsk_mod.c:76:6: branch_false: following ‘false’ branch (when ‘argc > 7’)...
codec2-1.2.0/src/fsk_mod.c:82:17: branch_false: ...to here
codec2-1.2.0/src/fsk_mod.c:88:6: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/fsk_mod.c:91:11: branch_false: ...to here
codec2-1.2.0/src/fsk_mod.c:91:11: acquire_memory: this call could return NULL
codec2-1.2.0/src/fsk_mod.c:95:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/fsk_mod.c:96:5: branch_true: ...to here
codec2-1.2.0/src/fsk_mod.c:103:6: branch_true: following ‘true’ branch (when ‘user_p == 0’)...
codec2-1.2.0/src/fsk_mod.c:103:16: branch_true: ...to here
codec2-1.2.0/src/fsk_mod.c:108:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/fsk_mod.c:118:10: danger: argument 4 (‘fin’) from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
# 116| uint8_t bitbuf[fsk->Nbits];
# 117|
# 118|-> while (fread(bitbuf, sizeof(uint8_t), fsk->Nbits, fin) == fsk->Nbits) {
# 119| if (test_mode) memset(bitbuf, 0, fsk->Nbits);
# 120| if (complex == 0) {
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/fsk_mod.c:126: warning[uninitvar]: Uninitialized variable: rawbuf
# 124| fsk_mod(fsk, modbuf, bitbuf, fsk->Nbits);
# 125| for (i = 0; i < fsk->N; i++) rawbuf[i] = (int16_t)(modbuf[i] * amp);
# 126|-> fwrite(rawbuf, bytes_per_sample, fsk->N, fout);
# 127| } else {
# 128| /* 16 bit signed char complex output */
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/fsk_mod.c:136: warning[uninitvar]: Uninitialized variable: rawbuf
# 134| rawbuf[2 * i + 1] = (int16_t)(modbuf[i].imag * amp);
# 135| }
# 136|-> fwrite(rawbuf, bytes_per_sample, fsk->N, fout);
# 137| }
# 138|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fsk_put_test_bits.c:118: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bitbuf_tx
# 116| srand(158324);
# 117| for (i = 0; i < framesize; i++) {
# 118|-> bitbuf_tx[i] = rand() & 0x1;
# 119| bitbuf_rx[i] = 0;
# 120| }
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fsk_put_test_bits.c:118:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘bitbuf_tx’
codec2-1.2.0/src/fsk_put_test_bits.c:83:6: branch_false: following ‘false’ branch (when ‘argc != 1’)...
codec2-1.2.0/src/fsk_put_test_bits.c:89:6: branch_false: ...to here
codec2-1.2.0/src/fsk_put_test_bits.c:89:6: branch_false: following ‘false’ branch (when ‘packed_in == 0’)...
codec2-1.2.0/src/fsk_put_test_bits.c:99:22: branch_false: ...to here
codec2-1.2.0/src/fsk_put_test_bits.c:106:6: branch_false: following ‘false’ branch (when ‘fin’ is non-NULL)...
codec2-1.2.0/src/fsk_put_test_bits.c:112:26: branch_false: ...to here
codec2-1.2.0/src/fsk_put_test_bits.c:112:26: acquire_memory: this call could return NULL
codec2-1.2.0/src/fsk_put_test_bits.c:117:15: branch_true: following ‘true’ branch (when ‘i < framesize’)...
codec2-1.2.0/src/fsk_put_test_bits.c:118:20: branch_true: ...to here
codec2-1.2.0/src/fsk_put_test_bits.c:118:5: danger: ‘bitbuf_tx + (sizetype)i’ could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
# 116| srand(158324);
# 117| for (i = 0; i < framesize; i++) {
# 118|-> bitbuf_tx[i] = rand() & 0x1;
# 119| bitbuf_rx[i] = 0;
# 120| }
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fsk_put_test_bits.c:119: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bitbuf_rx
# 117| for (i = 0; i < framesize; i++) {
# 118| bitbuf_tx[i] = rand() & 0x1;
# 119|-> bitbuf_rx[i] = 0;
# 120| }
# 121|
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/fsk_put_test_bits.c:119:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘bitbuf_rx’
codec2-1.2.0/src/fsk_put_test_bits.c:83:6: branch_false: following ‘false’ branch (when ‘argc != 1’)...
codec2-1.2.0/src/fsk_put_test_bits.c:89:6: branch_false: ...to here
codec2-1.2.0/src/fsk_put_test_bits.c:89:6: branch_false: following ‘false’ branch (when ‘packed_in == 0’)...
codec2-1.2.0/src/fsk_put_test_bits.c:99:22: branch_false: ...to here
codec2-1.2.0/src/fsk_put_test_bits.c:106:6: branch_false: following ‘false’ branch (when ‘fin’ is non-NULL)...
codec2-1.2.0/src/fsk_put_test_bits.c:112:26: branch_false: ...to here
codec2-1.2.0/src/fsk_put_test_bits.c:113:26: acquire_memory: this call could return NULL
codec2-1.2.0/src/fsk_put_test_bits.c:117:15: branch_true: following ‘true’ branch (when ‘i < framesize’)...
codec2-1.2.0/src/fsk_put_test_bits.c:118:20: branch_true: ...to here
codec2-1.2.0/src/fsk_put_test_bits.c:119:5: danger: ‘bitbuf_rx + (sizetype)i’ could be NULL: unchecked value from [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6)
# 117| for (i = 0; i < framesize; i++) {
# 118| bitbuf_tx[i] = rand() & 0x1;
# 119|-> bitbuf_rx[i] = 0;
# 120| }
# 121|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fsk_put_test_bits.c:134: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bitbuf_rx
# 132|
# 133| for (i = 0; i < framesize - 1; i++) {
# 134|-> bitbuf_rx[i] = bitbuf_rx[i + 1];
# 135| }
# 136| bitbuf_rx[framesize - 1] = abit;
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/fsk_put_test_bits.c:136: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bitbuf_rx
# 134| bitbuf_rx[i] = bitbuf_rx[i + 1];
# 135| }
# 136|-> bitbuf_rx[framesize - 1] = abit;
# 137|
# 138| /* compare to know tx frame. If they are time aligned, there
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/generate_codebook.c:120: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: b
# 118| *cursor = '\0';
# 119|
# 120|-> b->k = (int)get_float(file, name, &cursor, line, sizeof(line));
# 121| b->m = (int)get_float(file, name, &cursor, line, sizeof(line));
# 122| size = b->k * b->m;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/generate_codebook.c:120:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘b’
codec2-1.2.0/src/generate_codebook.c:132:5: enter_function: entry to ‘main’
codec2-1.2.0/src/generate_codebook.c:136:6: branch_false: following ‘false’ branch (when ‘argc > 1’)...
codec2-1.2.0/src/generate_codebook.c:136:6: branch_false: ...to here
codec2-1.2.0/src/generate_codebook.c:142:15: branch_true: following ‘true’ branch...
codec2-1.2.0/src/generate_codebook.c:143:27: branch_true: ...to here
codec2-1.2.0/src/generate_codebook.c:145:8: branch_false: following ‘false’ branch...
codec2-1.2.0/src/generate_codebook.c:150:13: branch_false: ...to here
codec2-1.2.0/src/generate_codebook.c:150:13: call_function: calling ‘load’ from ‘main’
# 118| *cursor = '\0';
# 119|
# 120|-> b->k = (int)get_float(file, name, &cursor, line, sizeof(line));
# 121| b->m = (int)get_float(file, name, &cursor, line, sizeof(line));
# 122| size = b->k * b->m;
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/generate_codebook.c:121: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: b
# 119|
# 120| b->k = (int)get_float(file, name, &cursor, line, sizeof(line));
# 121|-> b->m = (int)get_float(file, name, &cursor, line, sizeof(line));
# 122| size = b->k * b->m;
# 123|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/generate_codebook.c:122: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: b
# 120| b->k = (int)get_float(file, name, &cursor, line, sizeof(line));
# 121| b->m = (int)get_float(file, name, &cursor, line, sizeof(line));
# 122|-> size = b->k * b->m;
# 123|
# 124| b->cb = (float *)malloc(size * sizeof(float));
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/generate_codebook.c:124: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: b
# 122| size = b->k * b->m;
# 123|
# 124|-> b->cb = (float *)malloc(size * sizeof(float));
# 125|
# 126| for (i = 0; i < size; i++)
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/generate_codebook.c:127: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: b
# 125|
# 126| for (i = 0; i < size; i++)
# 127|-> b->cb[i] = get_float(file, name, &cursor, line, sizeof(line));
# 128|
# 129| return b;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/generate_codebook.c:150:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘cb’
codec2-1.2.0/src/generate_codebook.c:132:5: enter_function: entry to ‘main’
codec2-1.2.0/src/generate_codebook.c:133:26: acquire_memory: this call could return NULL
codec2-1.2.0/src/generate_codebook.c:136:6: branch_false: following ‘false’ branch (when ‘argc > 1’)...
codec2-1.2.0/src/generate_codebook.c:136:6: branch_false: ...to here
codec2-1.2.0/src/generate_codebook.c:142:15: branch_true: following ‘true’ branch...
codec2-1.2.0/src/generate_codebook.c:143:27: branch_true: ...to here
codec2-1.2.0/src/generate_codebook.c:145:8: branch_false: following ‘false’ branch...
codec2-1.2.0/src/generate_codebook.c:150:13: branch_false: ...to here
codec2-1.2.0/src/generate_codebook.c:150:13: call_function: calling ‘load’ from ‘main’
codec2-1.2.0/src/generate_codebook.c:150:13: return_function: returning to ‘main’ from ‘load’
codec2-1.2.0/src/generate_codebook.c:150:5: danger: ‘cb + (sizetype)i * 8’ could be NULL: unchecked value from [(2)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/1)
# 148| }
# 149|
# 150|-> cb[i] = load(in, argv[i + 2]);
# 151|
# 152| fclose(in);
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/interldpc.c:133:67: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*pbits[j]’
codec2-1.2.0/src/interldpc.c:221:5: enter_function: entry to ‘count_uncoded_errors’
codec2-1.2.0/src/interldpc.c:241:6: branch_false: following ‘false’ branch (when ‘crc16 == 0’)...
codec2-1.2.0/src/interldpc.c:247:3: branch_false: ...to here
codec2-1.2.0/src/interldpc.c:247:3: call_function: calling ‘ldpc_encode_frame’ from ‘count_uncoded_errors’
# 131| bits, we don't bother sending unused (known) data bits */
# 132| for (i = 0; i < ldpc->data_bits_per_frame; i++) codeword[i] = tx_bits_char[i];
# 133|-> for (j = 0; j < ldpc->NumberParityBits; i++, j++) codeword[i] = pbits[j];
# 134| }
# 135|
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/interldpc.c:261:29: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*rx_bits_raw[i]’
codec2-1.2.0/src/interldpc.c:221:5: enter_function: entry to ‘count_uncoded_errors’
codec2-1.2.0/src/interldpc.c:241:6: branch_false: following ‘false’ branch (when ‘crc16 == 0’)...
codec2-1.2.0/src/interldpc.c:247:3: branch_false: ...to here
codec2-1.2.0/src/interldpc.c:247:3: call_function: calling ‘ldpc_encode_frame’ from ‘count_uncoded_errors’
codec2-1.2.0/src/interldpc.c:247:3: return_function: returning to ‘count_uncoded_errors’ from ‘ldpc_encode_frame’
codec2-1.2.0/src/interldpc.c:249:15: branch_false: following ‘false’ branch (when ‘i >= coded_syms_per_frame’)...
codec2-1.2.0/src/interldpc.c:249:15: branch_false: ...to here
codec2-1.2.0/src/interldpc.c:260:15: branch_true: following ‘true’ branch...
codec2-1.2.0/src/interldpc.c:261:9: branch_true: ...to here
codec2-1.2.0/src/interldpc.c:261:29: danger: use of uninitialized value ‘*rx_bits_raw[i]’ here
# 259|
# 260| for (i = 0; i < coded_bits_per_frame; i++) {
# 261|-> if (test_codeword[i] != rx_bits_raw[i]) Nerrs++;
# 262| }
# 263|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/kiss_fft.c:223: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: scratch
# 221| k = u;
# 222| for (q1 = 0; q1 < p; ++q1) {
# 223|-> scratch[q1] = Fout[k];
# 224| C_FIXDIV(scratch[q1], p);
# 225| k += m;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/kiss_fft.c:223:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘scratch’
codec2-1.2.0/src/kiss_fft.c:392:6: enter_function: entry to ‘kiss_fft_stride’
codec2-1.2.0/src/kiss_fft.c:399:5: call_function: calling ‘kf_work’ from ‘kiss_fft_stride’
# 221| k = u;
# 222| for (q1 = 0; q1 < p; ++q1) {
# 223|-> scratch[q1] = Fout[k];
# 224| C_FIXDIV(scratch[q1], p);
# 225| k += m;
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/kiss_fft.c:231: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: scratch
# 229| for (q1 = 0; q1 < p; ++q1) {
# 230| int twidx = 0;
# 231|-> Fout[k] = scratch[0];
# 232| for (q = 1; q < p; ++q) {
# 233| twidx += fstride * k;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/kiss_fft.c:288:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘Fout’
codec2-1.2.0/src/kiss_fft.c:392:6: enter_function: entry to ‘kiss_fft_stride’
codec2-1.2.0/src/kiss_fft.c:398:25: acquire_memory: this call could return NULL
codec2-1.2.0/src/kiss_fft.c:399:5: call_function: calling ‘kf_work’ from ‘kiss_fft_stride’
# 286| if (m == 1) {
# 287| do {
# 288|-> *Fout = *f;
# 289| f += fstride * in_stride;
# 290| } while (++Fout != Fout_end);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/kiss_fft.c:400: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: tmpbuf
# 398| (kiss_fft_cpx *)KISS_FFT_TMP_ALLOC(sizeof(kiss_fft_cpx) * st->nfft);
# 399| kf_work(tmpbuf, fin, 1, in_stride, st->factors, st);
# 400|-> memcpy(fout, tmpbuf, sizeof(kiss_fft_cpx) * st->nfft);
# 401| KISS_FFT_TMP_FREE(tmpbuf);
# 402| } else {
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/ldpc_dec.c:165: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: input_float
# 163| fprintf(stderr, "CodeLength: %d offset: %d\n", CodeLength, offset);
# 164|
# 165|-> while (fread(input_float, sizeof(float), nread, fin) == nread) {
# 166| if (testframes) {
# 167| /* BPSK SD and bit LLRs get mapped roughly the same way so this just
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/lsp.c:295:48: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘n1[1]’
codec2-1.2.0/src/lsp.c:289:15: branch_true: following ‘true’ branch (when ‘j <= order’)...
codec2-1.2.0/src/lsp.c:289:15: branch_true: ...to here
codec2-1.2.0/src/lsp.c:290:17: branch_true: following ‘true’ branch...
codec2-1.2.0/src/lsp.c:291:17: branch_true: ...to here
codec2-1.2.0/src/lsp.c:295:48: danger: use of uninitialized value ‘n1[1]’ here
# 293| n3 = n2 + 1;
# 294| n4 = n3 + 1;
# 295|-> xout1 = xin1 - 2 * (freq[2 * i]) * *n1 + *n2;
# 296| xout2 = xin2 - 2 * (freq[2 * i + 1]) * *n3 + *n4;
# 297| *n2 = *n1;
Error: CPPCHECK_WARNING (CWE-682):
codec2-1.2.0/src/lsp.c:304: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
# 302| xin2 = xout2;
# 303| }
# 304|-> xout1 = xin1 + *(n4 + 1);
# 305| xout2 = xin2 - *(n4 + 2);
# 306| ak[j] = (xout1 + xout2) * 0.5;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/lsp.c:304:20: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘n4’
codec2-1.2.0/src/lsp.c:289:15: branch_true: following ‘true’ branch (when ‘j <= order’)...
codec2-1.2.0/src/lsp.c:289:15: branch_true: ...to here
codec2-1.2.0/src/lsp.c:290:17: branch_false: following ‘false’ branch...
codec2-1.2.0/src/lsp.c:304:20: branch_false: ...to here
codec2-1.2.0/src/lsp.c:304:20: danger: dereference of NULL ‘n4’
# 302| xin2 = xout2;
# 303| }
# 304|-> xout1 = xin1 + *(n4 + 1);
# 305| xout2 = xin2 - *(n4 + 2);
# 306| ak[j] = (xout1 + xout2) * 0.5;
Error: CPPCHECK_WARNING (CWE-682):
codec2-1.2.0/src/lsp.c:305: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
# 303| }
# 304| xout1 = xin1 + *(n4 + 1);
# 305|-> xout2 = xin2 - *(n4 + 2);
# 306| ak[j] = (xout1 + xout2) * 0.5;
# 307| *(n4 + 1) = xin1;
Error: CPPCHECK_WARNING (CWE-682):
codec2-1.2.0/src/lsp.c:307: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
# 305| xout2 = xin2 - *(n4 + 2);
# 306| ak[j] = (xout1 + xout2) * 0.5;
# 307|-> *(n4 + 1) = xin1;
# 308| *(n4 + 2) = xin2;
# 309|
Error: CPPCHECK_WARNING (CWE-682):
codec2-1.2.0/src/lsp.c:308: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
# 306| ak[j] = (xout1 + xout2) * 0.5;
# 307| *(n4 + 1) = xin1;
# 308|-> *(n4 + 2) = xin2;
# 309|
# 310| xin1 = 0.0;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mbest.c:46:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘mbest’
codec2-1.2.0/src/mbest.c:43:27: acquire_memory: this call could return NULL
codec2-1.2.0/src/mbest.c:46:3: danger: ‘mbest’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
# 44| assert(mbest != NULL);
# 45|
# 46|-> mbest->entries = entries;
# 47| mbest->list =
# 48| (struct MBEST_LIST *)malloc(entries * sizeof(struct MBEST_LIST));
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mbest.c:53:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc((long unsigned int)entries * 20)’
codec2-1.2.0/src/mbest.c:48:28: acquire_memory: this call could return NULL
codec2-1.2.0/src/mbest.c:51:15: branch_true: following ‘true’ branch (when ‘i < entries’)...
codec2-1.2.0/src/mbest.c:51:15: branch_true: ...to here
codec2-1.2.0/src/mbest.c:52:17: branch_true: following ‘true’ branch...
codec2-1.2.0/src/mbest.c:53:5: danger: ‘malloc((long unsigned int)entries * 20) + (long unsigned int)i * 20’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
# 51| for (i = 0; i < mbest->entries; i++) {
# 52| for (j = 0; j < MBEST_STAGES; j++) mbest->list[i].index[j] = 0;
# 53|-> mbest->list[i].error = 1E32;
# 54| }
# 55|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:66: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: run
# 64| mod = malloc((strlen(modname) + 1) * sizeof(char));
# 65| run = malloc((strlen(runname) + 1) * sizeof(char));
# 66|-> strcpy(run, runname);
# 67| strcpy(mod, modname);
# 68| }
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:67: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: mod
# 65| run = malloc((strlen(runname) + 1) * sizeof(char));
# 66| strcpy(run, runname);
# 67|-> strcpy(mod, modname);
# 68| }
# 69|
Error: CPPCHECK_WARNING (CWE-682):
codec2-1.2.0/src/modem_probe.c:87: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 85|
# 86| while (cur != NULL) {
# 87|-> memcpy(newbuf + i, cur->data, cur->len);
# 88| i += cur->len;
# 89| free(cur->data);
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/modem_probe.c:87:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘newbuf’ where non-null expected
codec2-1.2.0/src/modem_probe.c:84:18: acquire_memory: this call could return NULL
codec2-1.2.0/src/modem_probe.c:86:10: branch_true: following ‘true’ branch (when ‘cur’ is non-NULL)...
codec2-1.2.0/src/modem_probe.c:87:5: branch_true: ...to here
codec2-1.2.0/src/modem_probe.c:87:5: danger: argument 1 (‘newbuf + i’) from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 85|
# 86| while (cur != NULL) {
# 87|-> memcpy(newbuf + i, cur->data, cur->len);
# 88| i += cur->len;
# 89| free(cur->data);
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/modem_probe.c:130:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(run, "w")’ where non-null expected
codec2-1.2.0/src/modem_probe.c:100:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/modem_probe.c:103:3: branch_false: ...to here
codec2-1.2.0/src/modem_probe.c:104:20: acquire_memory: this call could return NULL
codec2-1.2.0/src/modem_probe.c:108:10: branch_false: following ‘false’ branch (when ‘cur’ is NULL)...
codec2-1.2.0/src/modem_probe.c:130:3: branch_false: ...to here
codec2-1.2.0/src/modem_probe.c:130:3: danger: argument 1 (‘fopen(run, "w")’) from [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
# 128| }
# 129|
# 130|-> fclose(dumpfile);
# 131| free(run);
# 132| free(mod);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:154: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: npti
# 152|
# 153| npti = (probe_trace_info *)malloc(sizeof(probe_trace_info));
# 154|-> npti->next = first_trace;
# 155| npti->data = NULL;
# 156| npti->last = NULL;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:154:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘npti’
codec2-1.2.0/src/modem_probe.c:140:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/modem_probe.c:142:3: branch_false: ...to here
codec2-1.2.0/src/modem_probe.c:153:30: acquire_memory: this call could return NULL
codec2-1.2.0/src/modem_probe.c:154:3: danger: ‘npti’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
# 152|
# 153| npti = (probe_trace_info *)malloc(sizeof(probe_trace_info));
# 154|-> npti->next = first_trace;
# 155| npti->data = NULL;
# 156| npti->last = NULL;
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:155: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: npti
# 153| npti = (probe_trace_info *)malloc(sizeof(probe_trace_info));
# 154| npti->next = first_trace;
# 155|-> npti->data = NULL;
# 156| npti->last = NULL;
# 157| strcpy(npti->name, tracename);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:156: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: npti
# 154| npti->next = first_trace;
# 155| npti->data = NULL;
# 156|-> npti->last = NULL;
# 157| strcpy(npti->name, tracename);
# 158| first_trace = npti;
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:157: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: npti
# 155| npti->data = NULL;
# 156| npti->last = NULL;
# 157|-> strcpy(npti->name, tracename);
# 158| first_trace = npti;
# 159|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:173: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 171|
# 172| ndat = (datlink *)malloc(sizeof(datlink));
# 173|-> ndat->data = malloc(sizeof(int32_t) * cnt);
# 174|
# 175| ndat->len = cnt * sizeof(int32_t);
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:173:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ndat’
codec2-1.2.0/src/modem_probe.c:163:6: enter_function: entry to ‘modem_probe_samp_i_int’
codec2-1.2.0/src/modem_probe.c:167:9: call_function: calling ‘modem_probe_get_trace’ from ‘modem_probe_samp_i_int’
codec2-1.2.0/src/modem_probe.c:167:9: return_function: returning to ‘modem_probe_samp_i_int’ from ‘modem_probe_get_trace’
codec2-1.2.0/src/modem_probe.c:168:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/modem_probe.c:170:3: branch_false: ...to here
codec2-1.2.0/src/modem_probe.c:172:21: acquire_memory: this call could return NULL
codec2-1.2.0/src/modem_probe.c:173:3: danger: ‘ndat’ could be NULL: unchecked value from [(11)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/10)
# 171|
# 172| ndat = (datlink *)malloc(sizeof(datlink));
# 173|-> ndat->data = malloc(sizeof(int32_t) * cnt);
# 174|
# 175| ndat->len = cnt * sizeof(int32_t);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:175: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 173| ndat->data = malloc(sizeof(int32_t) * cnt);
# 174|
# 175|-> ndat->len = cnt * sizeof(int32_t);
# 176| ndat->next = NULL;
# 177| memcpy(ndat->data, (void *)&(samp[0]), sizeof(int32_t) * cnt);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:176: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 174|
# 175| ndat->len = cnt * sizeof(int32_t);
# 176|-> ndat->next = NULL;
# 177| memcpy(ndat->data, (void *)&(samp[0]), sizeof(int32_t) * cnt);
# 178|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:177: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 175| ndat->len = cnt * sizeof(int32_t);
# 176| ndat->next = NULL;
# 177|-> memcpy(ndat->data, (void *)&(samp[0]), sizeof(int32_t) * cnt);
# 178|
# 179| if (pti->last != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/modem_probe.c:177:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(cnt * 4)’ where non-null expected
codec2-1.2.0/src/modem_probe.c:163:6: enter_function: entry to ‘modem_probe_samp_i_int’
codec2-1.2.0/src/modem_probe.c:167:9: call_function: calling ‘modem_probe_get_trace’ from ‘modem_probe_samp_i_int’
codec2-1.2.0/src/modem_probe.c:167:9: return_function: returning to ‘modem_probe_samp_i_int’ from ‘modem_probe_get_trace’
codec2-1.2.0/src/modem_probe.c:168:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/modem_probe.c:170:3: branch_false: ...to here
codec2-1.2.0/src/modem_probe.c:173:16: acquire_memory: this call could return NULL
codec2-1.2.0/src/modem_probe.c:177:3: danger: argument 1 (‘malloc(cnt * 4)’) from [(11)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/10) could be NULL where non-null expected
# 175| ndat->len = cnt * sizeof(int32_t);
# 176| ndat->next = NULL;
# 177|-> memcpy(ndat->data, (void *)&(samp[0]), sizeof(int32_t) * cnt);
# 178|
# 179| if (pti->last != NULL) {
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:198: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 196|
# 197| ndat = (datlink *)malloc(sizeof(datlink));
# 198|-> ndat->data = malloc(sizeof(float) * cnt);
# 199|
# 200| ndat->len = cnt * sizeof(float);
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:198:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ndat’
codec2-1.2.0/src/modem_probe.c:188:6: enter_function: entry to ‘modem_probe_samp_f_int’
codec2-1.2.0/src/modem_probe.c:192:9: call_function: calling ‘modem_probe_get_trace’ from ‘modem_probe_samp_f_int’
codec2-1.2.0/src/modem_probe.c:192:9: return_function: returning to ‘modem_probe_samp_f_int’ from ‘modem_probe_get_trace’
codec2-1.2.0/src/modem_probe.c:193:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/modem_probe.c:195:3: branch_false: ...to here
codec2-1.2.0/src/modem_probe.c:197:21: acquire_memory: this call could return NULL
codec2-1.2.0/src/modem_probe.c:198:3: danger: ‘ndat’ could be NULL: unchecked value from [(11)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/10)
# 196|
# 197| ndat = (datlink *)malloc(sizeof(datlink));
# 198|-> ndat->data = malloc(sizeof(float) * cnt);
# 199|
# 200| ndat->len = cnt * sizeof(float);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:200: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 198| ndat->data = malloc(sizeof(float) * cnt);
# 199|
# 200|-> ndat->len = cnt * sizeof(float);
# 201| ndat->next = NULL;
# 202| memcpy(ndat->data, (void *)&(samp[0]), sizeof(float) * cnt);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:201: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 199|
# 200| ndat->len = cnt * sizeof(float);
# 201|-> ndat->next = NULL;
# 202| memcpy(ndat->data, (void *)&(samp[0]), sizeof(float) * cnt);
# 203|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:202: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 200| ndat->len = cnt * sizeof(float);
# 201| ndat->next = NULL;
# 202|-> memcpy(ndat->data, (void *)&(samp[0]), sizeof(float) * cnt);
# 203|
# 204| if (pti->last != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/modem_probe.c:202:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(cnt * 4)’ where non-null expected
codec2-1.2.0/src/modem_probe.c:188:6: enter_function: entry to ‘modem_probe_samp_f_int’
codec2-1.2.0/src/modem_probe.c:192:9: call_function: calling ‘modem_probe_get_trace’ from ‘modem_probe_samp_f_int’
codec2-1.2.0/src/modem_probe.c:192:9: return_function: returning to ‘modem_probe_samp_f_int’ from ‘modem_probe_get_trace’
codec2-1.2.0/src/modem_probe.c:193:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/modem_probe.c:195:3: branch_false: ...to here
codec2-1.2.0/src/modem_probe.c:198:16: acquire_memory: this call could return NULL
codec2-1.2.0/src/modem_probe.c:202:3: danger: argument 1 (‘malloc(cnt * 4)’) from [(11)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/10) could be NULL where non-null expected
# 200| ndat->len = cnt * sizeof(float);
# 201| ndat->next = NULL;
# 202|-> memcpy(ndat->data, (void *)&(samp[0]), sizeof(float) * cnt);
# 203|
# 204| if (pti->last != NULL) {
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:223: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 221|
# 222| ndat = (datlink *)malloc(sizeof(datlink));
# 223|-> ndat->data = malloc(sizeof(COMP) * cnt);
# 224|
# 225| ndat->len = cnt * sizeof(COMP);
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:223:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ndat’
codec2-1.2.0/src/modem_probe.c:213:6: enter_function: entry to ‘modem_probe_samp_c_int’
codec2-1.2.0/src/modem_probe.c:217:9: call_function: calling ‘modem_probe_get_trace’ from ‘modem_probe_samp_c_int’
codec2-1.2.0/src/modem_probe.c:217:9: return_function: returning to ‘modem_probe_samp_c_int’ from ‘modem_probe_get_trace’
codec2-1.2.0/src/modem_probe.c:218:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/modem_probe.c:220:3: branch_false: ...to here
codec2-1.2.0/src/modem_probe.c:222:21: acquire_memory: this call could return NULL
codec2-1.2.0/src/modem_probe.c:223:3: danger: ‘ndat’ could be NULL: unchecked value from [(11)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/10)
# 221|
# 222| ndat = (datlink *)malloc(sizeof(datlink));
# 223|-> ndat->data = malloc(sizeof(COMP) * cnt);
# 224|
# 225| ndat->len = cnt * sizeof(COMP);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:225: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 223| ndat->data = malloc(sizeof(COMP) * cnt);
# 224|
# 225|-> ndat->len = cnt * sizeof(COMP);
# 226| ndat->next = NULL;
# 227| memcpy(ndat->data, (void *)&(samp[0]), sizeof(COMP) * cnt);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:226: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 224|
# 225| ndat->len = cnt * sizeof(COMP);
# 226|-> ndat->next = NULL;
# 227| memcpy(ndat->data, (void *)&(samp[0]), sizeof(COMP) * cnt);
# 228|
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/modem_probe.c:227: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ndat
# 225| ndat->len = cnt * sizeof(COMP);
# 226| ndat->next = NULL;
# 227|-> memcpy(ndat->data, (void *)&(samp[0]), sizeof(COMP) * cnt);
# 228|
# 229| if (pti->last != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/modem_probe.c:227:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(cnt * 8)’ where non-null expected
codec2-1.2.0/src/modem_probe.c:213:6: enter_function: entry to ‘modem_probe_samp_c_int’
codec2-1.2.0/src/modem_probe.c:217:9: call_function: calling ‘modem_probe_get_trace’ from ‘modem_probe_samp_c_int’
codec2-1.2.0/src/modem_probe.c:217:9: return_function: returning to ‘modem_probe_samp_c_int’ from ‘modem_probe_get_trace’
codec2-1.2.0/src/modem_probe.c:218:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/modem_probe.c:220:3: branch_false: ...to here
codec2-1.2.0/src/modem_probe.c:223:16: acquire_memory: this call could return NULL
codec2-1.2.0/src/modem_probe.c:227:3: danger: argument 1 (‘malloc(cnt * 8)’) from [(11)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/10) could be NULL where non-null expected
# 225| ndat->len = cnt * sizeof(COMP);
# 226| ndat->next = NULL;
# 227|-> memcpy(ndat->data, (void *)&(samp[0]), sizeof(COMP) * cnt);
# 228|
# 229| if (pti->last != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:159:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘c_nodes’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:493:13: acquire_memory: this call could return NULL
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
# 157| }
# 158| }
# 159|-> c_nodes[i].degree = count;
# 160| if (H1) {
# 161| if (i == 0) {
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:180:11: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘c_nodes’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:493:13: acquire_memory: this call could return NULL
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
# 178| c_nodes[cnt].degree = count;
# 179| if ((i == 0) || (i == (NumberParityBits / shift) - 1)) {
# 180|-> c_nodes[cnt].degree = count + 1;
# 181| } else {
# 182| c_nodes[cnt].degree = count + 2;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:182:11: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘c_nodes’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:493:13: acquire_memory: this call could return NULL
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
# 180| c_nodes[cnt].degree = count + 1;
# 181| } else {
# 182|-> c_nodes[cnt].degree = count + 2;
# 183| }
# 184| cnt++;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:249:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘c_nodes’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:493:13: acquire_memory: this call could return NULL
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
# 247| for (i = 0; i < NumberParityBits; i++) {
# 248| // Allocate sub nodes
# 249|-> c_nodes[i].subs = CALLOC(c_nodes[i].degree, sizeof(struct c_sub_node));
# 250| assert(c_nodes[i].subs);
# 251|
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:254:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc((long unsigned int)*<unknown>.degree, 8)’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
# 252| // Populate sub nodes
# 253| for (j = 0; j < c_nodes[i].degree; j++) {
# 254|-> c_nodes[i].subs[j].index = (H_rows[i + j * NumberParityBits] - 1);
# 255| }
# 256| }
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:268:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘v_nodes’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:495:13: acquire_memory: this call could return NULL
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
# 266| }
# 267| }
# 268|-> v_nodes[i].degree = count;
# 269| }
# 270|
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:298:23: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘v_nodes’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:495:13: acquire_memory: this call could return NULL
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
# 296| for (i = 0; i < CodeLength; i++) {
# 297| // Allocate sub nodes
# 298|-> v_nodes[i].subs = CALLOC(v_nodes[i].degree, sizeof(struct v_sub_node));
# 299| assert(v_nodes[i].subs);
# 300|
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:309:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*<unknown>.subs + (long unsigned int)j * 12’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
# 307| for (j = 0; j < v_nodes[i].degree; j++) {
# 308| if ((H1) && (i >= CodeLength - NumberParityBits + shift)) {
# 309|-> v_nodes[i].subs[j].index =
# 310| i - (CodeLength - NumberParityBits + shift) + count;
# 311| if (shift == 0) {
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:317:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*<unknown>.subs + (long unsigned int)j * 12’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
# 315| }
# 316| } else {
# 317|-> v_nodes[i].subs[j].index = (H_cols[i + j * NumberRowsHcols] - 1);
# 318| }
# 319|
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:340:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘c_nodes’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:493:13: acquire_memory: this call could return NULL
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
# 338| for (i = 0; i < NumberParityBits; i++) {
# 339| /* index tells which v-nodes this c-node is connected to */
# 340|-> for (j = 0; j < c_nodes[i].degree; j++) {
# 341| /* search the connected v-node for the proper message value */
# 342| for (v_index = 0; v_index < v_nodes[c_nodes[i].subs[j].index].degree;
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:342:43: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*<unknown>.subs + (long unsigned int)j * 8’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
# 340| for (j = 0; j < c_nodes[i].degree; j++) {
# 341| /* search the connected v-node for the proper message value */
# 342|-> for (v_index = 0; v_index < v_nodes[c_nodes[i].subs[j].index].degree;
# 343| v_index++)
# 344| if (v_nodes[c_nodes[i].subs[j].index].subs[v_index].index == i) {
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:433:11: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘DecodedBits’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:475:23: acquire_memory: this call could return NULL
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:498:3: return_function: returning to ‘run_ldpc_decoder’ from ‘init_c_v_nodes’
codec2-1.2.0/src/mpdecode_core.c:507:15: branch_false: following ‘false’ branch (when ‘i >= CodeLength’)...
codec2-1.2.0/src/mpdecode_core.c:510:14: branch_false: ...to here
codec2-1.2.0/src/mpdecode_core.c:510:14: call_function: calling ‘SumProduct’ from ‘run_ldpc_decoder’
# 431| /* count data bit errors, assuming that it is systematic */
# 432| for (i = 0; i < CodeLength - NumberParityBits; i++)
# 433|-> if (DecodedBits[i] != data[i]) bitErrors++;
# 434|
# 435| /* Halt if zero errors */
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/mpdecode_core.c:433:29: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘data’
codec2-1.2.0/src/mpdecode_core.c:454:5: enter_function: entry to ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:498:3: call_function: calling ‘init_c_v_nodes’ from ‘run_ldpc_decoder’
codec2-1.2.0/src/mpdecode_core.c:498:3: return_function: returning to ‘run_ldpc_decoder’ from ‘init_c_v_nodes’
codec2-1.2.0/src/mpdecode_core.c:503:19: acquire_memory: this call could return NULL
codec2-1.2.0/src/mpdecode_core.c:507:15: branch_false: following ‘false’ branch (when ‘i >= CodeLength’)...
codec2-1.2.0/src/mpdecode_core.c:510:14: branch_false: ...to here
codec2-1.2.0/src/mpdecode_core.c:510:14: call_function: calling ‘SumProduct’ from ‘run_ldpc_decoder’
# 431| /* count data bit errors, assuming that it is systematic */
# 432| for (i = 0; i < CodeLength - NumberParityBits; i++)
# 433|-> if (DecodedBits[i] != data[i]) bitErrors++;
# 434|
# 435| /* Halt if zero errors */
Error: GCC_ANALYZER_WARNING:
codec2-1.2.0/src/mpdecode_core.c:599:9: warning[-Wanalyzer-imprecise-fp-arithmetic]: use of floating-point arithmetic here might yield unexpected results
codec2-1.2.0/src/mpdecode_core.c:723:6: enter_function: entry to ‘fsk_rx_filt_to_llrs’
codec2-1.2.0/src/mpdecode_core.c:731:3: call_function: calling ‘Somap’ from ‘fsk_rx_filt_to_llrs’
# 597| int number_symbols) {
# 598| int n, i, j, k, mask;
# 599|-> float num[bps], den[bps];
# 600| float metric;
# 601|
Error: GCC_ANALYZER_WARNING:
codec2-1.2.0/src/mpdecode_core.c:599:19: warning[-Wanalyzer-imprecise-fp-arithmetic]: use of floating-point arithmetic here might yield unexpected results
codec2-1.2.0/src/mpdecode_core.c:723:6: enter_function: entry to ‘fsk_rx_filt_to_llrs’
codec2-1.2.0/src/mpdecode_core.c:731:3: call_function: calling ‘Somap’ from ‘fsk_rx_filt_to_llrs’
# 597| int number_symbols) {
# 598| int n, i, j, k, mask;
# 599|-> float num[bps], den[bps];
# 600| float metric;
# 601|
Error: GCC_ANALYZER_WARNING:
codec2-1.2.0/src/mpdecode_core.c:728:9: warning[-Wanalyzer-imprecise-fp-arithmetic]: use of floating-point arithmetic here might yield unexpected results
# 726| int bps = log2(M);
# 727| float symbol_likelihood[M * nsyms];
# 728|-> float bit_likelihood[bps * nsyms];
# 729|
# 730| FskDemod(symbol_likelihood, rx_filt, v_est, SNRest, M, nsyms);
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/mpdecode_core.c:733:15: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*bit_likelihood[i]’
codec2-1.2.0/src/mpdecode_core.c:732:15: branch_true: following ‘true’ branch...
codec2-1.2.0/src/mpdecode_core.c:733:15: branch_true: ...to here
codec2-1.2.0/src/mpdecode_core.c:733:15: danger: use of uninitialized value ‘*bit_likelihood[i]’ here
# 731| Somap(bit_likelihood, symbol_likelihood, M, bps, nsyms);
# 732| for (i = 0; i < bps * nsyms; i++) {
# 733|-> llr[i] = -bit_likelihood[i];
# 734| }
# 735| }
Error: GCC_ANALYZER_WARNING (CWE-476):
codec2-1.2.0/src/nlp.c:131:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc((long unsigned int)(*c2const.n_samp + 48) * 4)’
codec2-1.2.0/src/nlp.c:118:6: branch_false: following ‘false’ branch (when ‘nlp’ is non-NULL)...
codec2-1.2.0/src/nlp.c:121:3: branch_false: ...to here
codec2-1.2.0/src/nlp.c:127:6: branch_true: following ‘true’ branch (when ‘Fs == 16000’)...
codec2-1.2.0/src/nlp.c:129:62: branch_true: ...to here
codec2-1.2.0/src/nlp.c:129:18: acquire_memory: this call could return NULL
codec2-1.2.0/src/nlp.c:130:17: branch_true: following ‘true’ branch (when ‘i != 48’)...
codec2-1.2.0/src/nlp.c:131:17: branch_true: ...to here
codec2-1.2.0/src/nlp.c:131:7: danger: ‘malloc((long unsigned int)(*c2const.n_samp + 48) * 4) + (long unsigned int)i * 4’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
# 129| (float *)malloc(sizeof(float) * (FDMDV_OS_TAPS_16K + c2const->n_samp));
# 130| for (i = 0; i < FDMDV_OS_TAPS_16K; i++) {
# 131|-> nlp->Sn16k[i] = 0.0;
# 132| }
# 133| if (nlp->Sn16k == NULL) {
Error: CPPCHECK_WARNING (CWE-401):
codec2-1.2.0/src/nlp.c:157: error[memleak]: Memory leak: nlp.Sn16k
# 155| assert(nlp->fft_cfg != NULL);
# 156|
# 157|-> return (void *)nlp;
# 158| }
# 159|
Error: CPPCHECK_WARNING (CWE-786):
codec2-1.2.0/src/nlp.c:469: error[negativeIndex]: Array 'in16k[0]' accessed at index -48, which is out of bounds.
# 467| /* update filter memory */
# 468|
# 469|-> for (i = -FDMDV_OS_TAPS_16K; i < 0; i++) in16k[i] = in16k[i + n * FDMDV_OS];
# 470| }
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/ofdm.c:686:19: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*vector’
codec2-1.2.0/src/ofdm.c:1538:13: enter_function: entry to ‘ofdm_demod_core’
codec2-1.2.0/src/ofdm.c:1555:6: branch_false: following ‘false’ branch...
codec2-1.2.0/src/ofdm.c:1629:3: branch_false: ...to here
codec2-1.2.0/src/ofdm.c:1645:23: branch_false: following ‘false’ branch (when ‘j >= en’)...
codec2-1.2.0/src/ofdm.c:1663:13: branch_false: ...to here
codec2-1.2.0/src/ofdm.c:1663:3: call_function: calling ‘dft’ from ‘ofdm_demod_core’
# 684|
# 685| for (col = 0; col < (ofdm->nc + 2); col++) {
# 686|-> result[col] = vector[0]; // conj(cexp(j0)) == 1
# 687| }
# 688|
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/ofdm.c:752:46: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘rightPtr[2]’
codec2-1.2.0/src/ofdm.c:1473:12: enter_function: entry to ‘ofdm_sync_search_core’
codec2-1.2.0/src/ofdm.c:1479:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/ofdm.c:1480:12: branch_true: ...to here
codec2-1.2.0/src/ofdm.c:1480:12: call_function: calling ‘ofdm_sync_search_burst’ from ‘ofdm_sync_search_core’
# 750| vec2 = mvec[0].c, mvec[0].d, mvec[1].c, mvec1[1].d, ... */
# 751| float4 vec1 = {leftPtr[0], leftPtr[1], leftPtr[2], leftPtr[3]};
# 752|-> float4 vec2 = {rightPtr[0], rightPtr[1], rightPtr[2], rightPtr[3]};
# 753|
# 754| accumPos += vec1 * vec2;
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/ofdm.c:1896:47: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*aphase_est_pilot[i]’
codec2-1.2.0/src/ofdm.c:1538:13: enter_function: entry to ‘ofdm_demod_core’
codec2-1.2.0/src/ofdm.c:1663:3: call_function: calling ‘dft’ from ‘ofdm_demod_core’
codec2-1.2.0/src/ofdm.c:1663:3: return_function: returning to ‘ofdm_demod_core’ from ‘dft’
codec2-1.2.0/src/ofdm.c:1754:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/ofdm.c:1762:43: branch_true: ...to here
codec2-1.2.0/src/ofdm.c:1784:15: branch_false: following ‘false’ branch...
codec2-1.2.0/src/ofdm.c:1784:15: branch_false: ...to here
codec2-1.2.0/src/ofdm.c:1789:15: branch_false: following ‘false’ branch...
codec2-1.2.0/src/ofdm.c:1789:15: branch_false: ...to here
codec2-1.2.0/src/ofdm.c:1880:16: branch_true: following ‘true’ branch...
codec2-1.2.0/src/ofdm.c:1880:16: branch_true: ...to here
codec2-1.2.0/src/ofdm.c:1887:17: branch_true: following ‘true’ branch...
codec2-1.2.0/src/ofdm.c:1888:11: branch_true: ...to here
codec2-1.2.0/src/ofdm.c:1888:10: branch_true: following ‘true’ branch...
codec2-1.2.0/src/ofdm.c:1889:13: branch_true: ...to here
codec2-1.2.0/src/ofdm.c:1889:12: branch_false: following ‘false’ branch...
codec2-1.2.0/src/ofdm.c:1896:47: branch_false: ...to here
codec2-1.2.0/src/ofdm.c:1896:47: danger: use of uninitialized value ‘*aphase_est_pilot[i]’ here
# 1894| } else {
# 1895| /* regular coherent detection */
# 1896|-> rx_corr = ofdm->rx_sym[rr + 2][i] * cmplxconj(aphase_est_pilot[i]);
# 1897| }
# 1898| } else {
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/ofdm.c:1913:49: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*aamp_est_pilot[i]’
codec2-1.2.0/src/ofdm.c:1538:13: enter_function: entry to ‘ofdm_demod_core’
codec2-1.2.0/src/ofdm.c:1663:3: call_function: calling ‘dft’ from ‘ofdm_demod_core’
codec2-1.2.0/src/ofdm.c:1663:3: return_function: returning to ‘ofdm_demod_core’ from ‘dft’
codec2-1.2.0/src/ofdm.c:1754:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/ofdm.c:1762:43: branch_true: ...to here
codec2-1.2.0/src/ofdm.c:1784:15: branch_false: following ‘false’ branch...
codec2-1.2.0/src/ofdm.c:1784:15: branch_false: ...to here
codec2-1.2.0/src/ofdm.c:1789:15: branch_false: following ‘false’ branch...
codec2-1.2.0/src/ofdm.c:1789:15: branch_false: ...to here
codec2-1.2.0/src/ofdm.c:1880:16: branch_true: following ‘true’ branch...
codec2-1.2.0/src/ofdm.c:1880:16: branch_true: ...to here
codec2-1.2.0/src/ofdm.c:1887:17: branch_true: following ‘true’ branch...
codec2-1.2.0/src/ofdm.c:1888:11: branch_true: ...to here
codec2-1.2.0/src/ofdm.c:1888:10: branch_false: following ‘false’ branch...
codec2-1.2.0/src/ofdm.c:1899:19: branch_false: ...to here
codec2-1.2.0/src/ofdm.c:1913:49: danger: use of uninitialized value ‘*aamp_est_pilot[i]’ here
# 1911| * so convenient to log them all
# 1912| */
# 1913|-> ofdm->rx_amp[(rr * ofdm->nc) + (i - 1)] = aamp_est_pilot[i];
# 1914| sum_amp += aamp_est_pilot[i];
# 1915|
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/ofdm.c:2615: warning[uninitvar]: Uninitialized variable: preamble_bits
# 2613| ofdm_preamble.tx_bpf_en = false;
# 2614| ofdm_preamble.clip_en = false;
# 2615|-> ofdm_mod(&ofdm_preamble, tx_preamble, preamble_bits);
# 2616| }
# 2617|
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/ofdm_mod.c:406: warning[uninitvar]: Uninitialized variable: tx_bits
# 404| for (i = 0; i < Nbitsperpacket; i++) tx_bits[i] = tx_bits_char[i];
# 405| COMP tx_sams[Nsamperpacket];
# 406|-> ofdm_mod(ofdm, tx_sams, tx_bits);
# 407| for (i = 0; i < Nsamperpacket; i++) tx_real[i] = tx_sams[i].real;
# 408| }
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/ofdm_mod.c:430: warning[uninitvar]: Uninitialized variable: sil_short
# 428| short sil_short[samples_delay];
# 429| for (int i = 0; i < samples_delay; i++) sil_short[i] = 0;
# 430|-> fwrite(sil_short, sizeof(short), samples_delay, fout);
# 431| }
# 432| }
Error: COMPILER_WARNING:
codec2-1.2.0/src/postfilter.c: scope_hint: In function ‘postfilter’
codec2-1.2.0/src/postfilter.c:104:10: warning[-Wunused-but-set-variable=]: variable ‘uv’ set but not used
# 104 | int m, uv;
# | ^~
# 102|
# 103| void postfilter(MODEL *model, float *bg_est) {
# 104|-> int m, uv;
# 105| float e, thresh;
# 106|
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/quantise.c:109: error[ctuuninitvar]: Using argument se that points at uninitialized variable se
# 107| }
# 108|
# 109|-> *se += beste;
# 110|
# 111| return (besti);
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/quantise.c:109: warning[uninitvar]: Uninitialized variable: *se
# 107| }
# 108|
# 109|-> *se += beste;
# 110|
# 111| return (besti);
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/quantise.c:109:3: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*se’
codec2-1.2.0/src/quantise.c:706:6: enter_function: entry to ‘encode_lsps_scalar’
codec2-1.2.0/src/quantise.c:721:15: branch_true: following ‘true’ branch (when ‘i < order’)...
codec2-1.2.0/src/quantise.c:722:5: branch_true: ...to here
codec2-1.2.0/src/quantise.c:725:18: call_function: calling ‘quantise’ from ‘encode_lsps_scalar’
# 107| }
# 108|
# 109|-> *se += beste;
# 110|
# 111| return (besti);
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/quantise.c:252:15: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*err[<unknown>]’
codec2-1.2.0/src/quantise.c:247:15: branch_false: following ‘false’ branch (when ‘i >= order’)...
codec2-1.2.0/src/quantise.c:247:15: branch_false: ...to here
codec2-1.2.0/src/quantise.c:251:15: branch_true: following ‘true’ branch...
codec2-1.2.0/src/quantise.c:252:19: branch_true: ...to here
codec2-1.2.0/src/quantise.c:252:15: danger: use of uninitialized value ‘*err[<unknown>]’ here
# 250| }
# 251| for (i = 0; i < order / 2; i++) {
# 252|-> err2[i] = err[2 * i];
# 253| err3[i] = err[2 * i + 1];
# 254| w2[i] = w[2 * i];
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/quantise.c:257: warning[uninitvar]: Uninitialized variable: w2
# 255| w3[i] = w[2 * i + 1];
# 256| }
# 257|-> n2 = find_nearest_weighted(codebook2, lsp_cbjmv[1].m, err2, w2, order / 2);
# 258| n3 = find_nearest_weighted(codebook3, lsp_cbjmv[2].m, err3, w3, order / 2);
# 259|
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/quantise.c:258: warning[uninitvar]: Uninitialized variable: w3
# 256| }
# 257| n2 = find_nearest_weighted(codebook2, lsp_cbjmv[1].m, err2, w2, order / 2);
# 258|-> n3 = find_nearest_weighted(codebook3, lsp_cbjmv[2].m, err3, w3, order / 2);
# 259|
# 260| for (i = 0; i < order / 2; i++) {
Error: GCC_ANALYZER_WARNING (CWE-457):
codec2-1.2.0/src/quantise.c:787:15: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*err[<unknown>]’
codec2-1.2.0/src/quantise.c:782:15: branch_false: following ‘false’ branch (when ‘i >= order’)...
codec2-1.2.0/src/quantise.c:782:15: branch_false: ...to here
codec2-1.2.0/src/quantise.c:786:15: branch_true: following ‘true’ branch...
codec2-1.2.0/src/quantise.c:787:19: branch_true: ...to here
codec2-1.2.0/src/quantise.c:787:15: danger: use of uninitialized value ‘*err[<unknown>]’ here
# 785| }
# 786| for (i = 0; i < order / 2; i++) {
# 787|-> err2[i] = err[2 * i];
# 788| err3[i] = err[2 * i + 1];
# 789| w2[i] = w[2 * i];
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/quantise.c:792: warning[uninitvar]: Uninitialized variable: w2
# 790| w3[i] = w[2 * i + 1];
# 791| }
# 792|-> n2 = find_nearest_weighted(codebook2, lsp_cbjmv[1].m, err2, w2, order / 2);
# 793| n3 = find_nearest_weighted(codebook3, lsp_cbjmv[2].m, err3, w3, order / 2);
# 794|
Error: CPPCHECK_WARNING (CWE-457):
codec2-1.2.0/src/quantise.c:793: warning[uninitvar]: Uninitialized variable: w3
# 791| }
# 792| n2 = find_nearest_weighted(codebook2, lsp_cbjmv[1].m, err2, w2, order / 2);
# 793|-> n3 = find_nearest_weighted(codebook3, lsp_cbjmv[2].m, err3, w3, order / 2);
# 794|
# 795| indexes[0] = n1;
Error: COMPILER_WARNING (CWE-563):
codec2-1.2.0/src/quantise.c: scope_hint: In function ‘quantise_WoE’
codec2-1.2.0/src/quantise.c:1018:9: warning[-Wunused-variable]: unused variable ‘Fs’
# 1018 | float Fs = c2const->Fs;
# | ^~
# 1016| float Wo_min = c2const->Wo_min;
# 1017| float Wo_max = c2const->Wo_max;
# 1018|-> float Fs = c2const->Fs;
# 1019|
# 1020| /* VQ is only trained for Fs = 8000 Hz */
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/vhf_deframe_c2.c:91: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bitbuf
# 89|
# 90| /* Deframe! */
# 91|-> while (fread(bitbuf, sizeof(uint8_t), fsize, fin) == fsize) {
# 92| if (fvhff_deframe_bits(deframer, c2buf, NULL, NULL, bitbuf))
# 93| fwrite(c2buf, sizeof(uint8_t), c2size, fout);
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/vhf_deframe_c2.c:109:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fin’ where non-null expected
codec2-1.2.0/src/vhf_deframe_c2.c:46:6: branch_false: following ‘false’ branch (when ‘argc > 2’)...
codec2-1.2.0/src/vhf_deframe_c2.c:52:7: branch_false: ...to here
codec2-1.2.0/src/vhf_deframe_c2.c:63:6: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/vhf_deframe_c2.c:66:11: branch_false: ...to here
codec2-1.2.0/src/vhf_deframe_c2.c:66:11: acquire_memory: this call could return NULL
codec2-1.2.0/src/vhf_deframe_c2.c:69:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/vhf_deframe_c2.c:70:5: branch_true: ...to here
codec2-1.2.0/src/vhf_deframe_c2.c:78:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/vhf_deframe_c2.c:79:5: branch_true: ...to here
codec2-1.2.0/src/vhf_deframe_c2.c:109:3: danger: argument 1 (‘fin’) from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
# 107|
# 108| cleanup:
# 109|-> fclose(fin);
# 110| fclose(fout);
# 111| fvhff_destroy_deframer(deframer);
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/vhf_deframe_c2.c:110:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fout’ where non-null expected
codec2-1.2.0/src/vhf_deframe_c2.c:46:6: branch_false: following ‘false’ branch (when ‘argc > 2’)...
codec2-1.2.0/src/vhf_deframe_c2.c:52:7: branch_false: ...to here
codec2-1.2.0/src/vhf_deframe_c2.c:69:6: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/vhf_deframe_c2.c:72:12: branch_false: ...to here
codec2-1.2.0/src/vhf_deframe_c2.c:72:12: acquire_memory: this call could return NULL
codec2-1.2.0/src/vhf_deframe_c2.c:78:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/vhf_deframe_c2.c:79:5: branch_true: ...to here
codec2-1.2.0/src/vhf_deframe_c2.c:110:3: danger: argument 1 (‘fout’) from [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
# 108| cleanup:
# 109| fclose(fin);
# 110|-> fclose(fout);
# 111| fvhff_destroy_deframer(deframer);
# 112| exit(0);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/vhf_frame_c2.c:90: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: c2buf
# 88|
# 89| /* Deframe! */
# 90|-> while (fread(c2buf, sizeof(uint8_t), c2size, fin) == c2size) {
# 91| fvhff_frame_bits(frame_fmt, bitbuf, c2buf, NULL, NULL);
# 92| fwrite(bitbuf, sizeof(uint8_t), fsize, fout);
Error: CPPCHECK_WARNING (CWE-476):
codec2-1.2.0/src/vhf_frame_c2.c:92: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bitbuf
# 90| while (fread(c2buf, sizeof(uint8_t), c2size, fin) == c2size) {
# 91| fvhff_frame_bits(frame_fmt, bitbuf, c2buf, NULL, NULL);
# 92|-> fwrite(bitbuf, sizeof(uint8_t), fsize, fout);
# 93|
# 94| if (fout == stdin) {
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/vhf_frame_c2.c:103:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fin’ where non-null expected
codec2-1.2.0/src/vhf_frame_c2.c:45:6: branch_false: following ‘false’ branch (when ‘argc > 2’)...
codec2-1.2.0/src/vhf_frame_c2.c:51:7: branch_false: ...to here
codec2-1.2.0/src/vhf_frame_c2.c:62:6: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/vhf_frame_c2.c:65:11: branch_false: ...to here
codec2-1.2.0/src/vhf_frame_c2.c:65:11: acquire_memory: this call could return NULL
codec2-1.2.0/src/vhf_frame_c2.c:68:6: branch_true: following ‘true’ branch (when the strings are equal)...
codec2-1.2.0/src/vhf_frame_c2.c:69:5: branch_true: ...to here
codec2-1.2.0/src/vhf_frame_c2.c:77:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/vhf_frame_c2.c:78:5: branch_true: ...to here
codec2-1.2.0/src/vhf_frame_c2.c:103:3: danger: argument 1 (‘fin’) from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
# 101|
# 102| cleanup:
# 103|-> fclose(fin);
# 104| fclose(fout);
# 105| fvhff_destroy_deframer(deframer);
Error: GCC_ANALYZER_WARNING (CWE-688):
codec2-1.2.0/src/vhf_frame_c2.c:104:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fout’ where non-null expected
codec2-1.2.0/src/vhf_frame_c2.c:45:6: branch_false: following ‘false’ branch (when ‘argc > 2’)...
codec2-1.2.0/src/vhf_frame_c2.c:51:7: branch_false: ...to here
codec2-1.2.0/src/vhf_frame_c2.c:68:6: branch_false: following ‘false’ branch (when the strings are non-equal)...
codec2-1.2.0/src/vhf_frame_c2.c:71:12: branch_false: ...to here
codec2-1.2.0/src/vhf_frame_c2.c:71:12: acquire_memory: this call could return NULL
codec2-1.2.0/src/vhf_frame_c2.c:77:6: branch_true: following ‘true’ branch...
codec2-1.2.0/src/vhf_frame_c2.c:78:5: branch_true: ...to here
codec2-1.2.0/src/vhf_frame_c2.c:104:3: danger: argument 1 (‘fout’) from [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
# 102| cleanup:
# 103| fclose(fin);
# 104|-> fclose(fout);
# 105| fvhff_destroy_deframer(deframer);
# 106| exit(0);