Fixed findings

List of Findings

Error: CPPCHECK_WARNING (CWE-758): [#def1]
opus-1.5.2/celt/celt_decoder.c:791: error[subtractPointers]: Subtracting pointers that point to different objects
#  789|               celt_fir(exc+MAX_PERIOD-exc_length, lpc+c*CELT_LPC_ORDER,
#  790|                     fir_tmp, exc_length, CELT_LPC_ORDER, st->arch);
#  791|->             OPUS_COPY(exc+MAX_PERIOD-exc_length, fir_tmp, exc_length);
#  792|            }
#  793|   

Error: COMPILER_WARNING: [#def2]
opus-1.5.2/celt/opus_custom_demo.c: scope_hint: In function ‘main’
opus-1.5.2/celt/opus_custom_demo.c:59:8: warning[-Wunused-but-set-variable=]: variable ‘count’ set but not used
#   59 |    int count = 0;
#      |        ^~~~~
#   57|      double rmsd = 0;
#   58|   #endif
#   59|->    int count = 0;
#   60|      opus_int32 skip;
#   61|      opus_int16 *in, *out;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
opus-1.5.2/celt/opus_custom_demo.c:104:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(outFile, "wb+")’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:96:11: acquire_resource: opened here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:104:10: throw: if ‘opus_custom_encoder_create’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:104:10: danger: ‘fopen(outFile, "wb+")’ leaks here; was opened at [(9)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/8)
#  102|      }
#  103|   
#  104|->    enc = opus_custom_encoder_create(mode, channels, &err);
#  105|      if (err != 0)
#  106|      {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
opus-1.5.2/celt/opus_custom_demo.c:104:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(outFile, "wb+")’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:96:11: acquire_memory: allocated here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:104:10: throw: if ‘opus_custom_encoder_create’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:104:10: danger: ‘fopen(outFile, "wb+")’ leaks here; was allocated at [(9)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/8)
#  102|      }
#  103|   
#  104|->    enc = opus_custom_encoder_create(mode, channels, &err);
#  105|      if (err != 0)
#  106|      {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def5]
opus-1.5.2/celt/opus_custom_demo.c:105:8: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(outFile, "wb+")’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:96:11: acquire_resource: opened here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:105:7: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:107:7: branch_true: ...to here
opus-1.5.2/celt/opus_custom_demo.c:107:7: throw: if ‘opus_strerror’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:105:8: danger: ‘fopen(outFile, "wb+")’ leaks here; was opened at [(9)](sarif:/runs/0/results/28/codeFlows/0/threadFlows/0/locations/8)
#  103|   
#  104|      enc = opus_custom_encoder_create(mode, channels, &err);
#  105|->    if (err != 0)
#  106|      {
#  107|         fprintf(stderr, "Failed to create the encoder: %s\n", opus_strerror(err));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
opus-1.5.2/celt/opus_custom_demo.c:105:8: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(outFile, "wb+")’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:96:11: acquire_memory: allocated here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:105:7: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:107:7: branch_true: ...to here
opus-1.5.2/celt/opus_custom_demo.c:107:7: throw: if ‘opus_strerror’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:105:8: danger: ‘fopen(outFile, "wb+")’ leaks here; was allocated at [(9)](sarif:/runs/0/results/30/codeFlows/0/threadFlows/0/locations/8)
#  103|   
#  104|      enc = opus_custom_encoder_create(mode, channels, &err);
#  105|->    if (err != 0)
#  106|      {
#  107|         fprintf(stderr, "Failed to create the encoder: %s\n", opus_strerror(err));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
opus-1.5.2/celt/opus_custom_demo.c:137:13: warning[-Wanalyzer-malloc-leak]: leak of ‘in’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:105:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:112:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:113:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:120:4: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:128:22: acquire_memory: allocated here
opus-1.5.2/celt/opus_custom_demo.c:131:11: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:134:13: branch_true: ...to here
opus-1.5.2/celt/opus_custom_demo.c:135:10: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:137:13: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:137:13: throw: if ‘opus_custom_encode’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:137:13: danger: ‘in’ leaks here; was allocated at [(15)](sarif:/runs/0/results/52/codeFlows/0/threadFlows/0/locations/14)
#  135|         if (feof(fin))
#  136|            break;
#  137|->       len = opus_custom_encode(enc, in, frame_size, data, bytes_per_packet);
#  138|         if (len <= 0)
#  139|            fprintf (stderr, "opus_custom_encode() failed: %s\n", opus_strerror(len));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
opus-1.5.2/celt/opus_custom_demo.c:137:13: warning[-Wanalyzer-malloc-leak]: leak of ‘out’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:105:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:112:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:113:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:120:4: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:129:23: acquire_memory: allocated here
opus-1.5.2/celt/opus_custom_demo.c:131:11: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:134:13: branch_true: ...to here
opus-1.5.2/celt/opus_custom_demo.c:135:10: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:137:13: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:137:13: throw: if ‘opus_custom_encode’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:137:13: danger: ‘out’ leaks here; was allocated at [(15)](sarif:/runs/0/results/53/codeFlows/0/threadFlows/0/locations/14)
#  135|         if (feof(fin))
#  136|            break;
#  137|->       len = opus_custom_encode(enc, in, frame_size, data, bytes_per_packet);
#  138|         if (len <= 0)
#  139|            fprintf (stderr, "opus_custom_encode() failed: %s\n", opus_strerror(len));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
opus-1.5.2/celt/opus_custom_demo.c:168:16: warning[-Wanalyzer-malloc-leak]: leak of ‘in’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:105:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:112:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:113:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:120:4: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:128:22: acquire_memory: allocated here
opus-1.5.2/celt/opus_custom_demo.c:131:11: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:134:13: branch_true: ...to here
opus-1.5.2/celt/opus_custom_demo.c:135:10: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:137:13: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:166:10: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:168:16: throw: if ‘opus_custom_decode’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:168:16: danger: ‘in’ leaks here; was allocated at [(15)](sarif:/runs/0/results/56/codeFlows/0/threadFlows/0/locations/14)
#  166|         if (argc==9 && rand()%1000<atoi(argv[argc-3]))
#  167|         /*if (errors && (errors%2==0))*/
#  168|->          ret = opus_custom_decode(dec, NULL, len, out, frame_size);
#  169|         else
#  170|            ret = opus_custom_decode(dec, data, len, out, frame_size);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
opus-1.5.2/celt/opus_custom_demo.c:168:16: warning[-Wanalyzer-malloc-leak]: leak of ‘out’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:105:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:112:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:113:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:120:4: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:129:23: acquire_memory: allocated here
opus-1.5.2/celt/opus_custom_demo.c:131:11: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:134:13: branch_true: ...to here
opus-1.5.2/celt/opus_custom_demo.c:135:10: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:137:13: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:166:10: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:168:16: throw: if ‘opus_custom_decode’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:168:16: danger: ‘out’ leaks here; was allocated at [(15)](sarif:/runs/0/results/57/codeFlows/0/threadFlows/0/locations/14)
#  166|         if (argc==9 && rand()%1000<atoi(argv[argc-3]))
#  167|         /*if (errors && (errors%2==0))*/
#  168|->          ret = opus_custom_decode(dec, NULL, len, out, frame_size);
#  169|         else
#  170|            ret = opus_custom_decode(dec, data, len, out, frame_size);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
opus-1.5.2/celt/opus_custom_demo.c:170:16: warning[-Wanalyzer-malloc-leak]: leak of ‘in’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:105:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:112:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:113:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:120:4: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:128:22: acquire_memory: allocated here
opus-1.5.2/celt/opus_custom_demo.c:131:11: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:134:13: branch_true: ...to here
opus-1.5.2/celt/opus_custom_demo.c:135:10: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:137:13: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:170:16: throw: if ‘opus_custom_decode’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:170:16: danger: ‘in’ leaks here; was allocated at [(15)](sarif:/runs/0/results/58/codeFlows/0/threadFlows/0/locations/14)
#  168|            ret = opus_custom_decode(dec, NULL, len, out, frame_size);
#  169|         else
#  170|->          ret = opus_custom_decode(dec, data, len, out, frame_size);
#  171|         if (ret < 0)
#  172|            fprintf(stderr, "opus_custom_decode() failed: %s\n", opus_strerror(ret));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
opus-1.5.2/celt/opus_custom_demo.c:170:16: warning[-Wanalyzer-malloc-leak]: leak of ‘out’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:105:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:112:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:113:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:120:4: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:129:23: acquire_memory: allocated here
opus-1.5.2/celt/opus_custom_demo.c:131:11: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:134:13: branch_true: ...to here
opus-1.5.2/celt/opus_custom_demo.c:135:10: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:137:13: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:170:16: throw: if ‘opus_custom_decode’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:170:16: danger: ‘out’ leaks here; was allocated at [(15)](sarif:/runs/0/results/59/codeFlows/0/threadFlows/0/locations/14)
#  168|            ret = opus_custom_decode(dec, NULL, len, out, frame_size);
#  169|         else
#  170|->          ret = opus_custom_decode(dec, data, len, out, frame_size);
#  171|         if (ret < 0)
#  172|            fprintf(stderr, "opus_custom_decode() failed: %s\n", opus_strerror(ret));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
opus-1.5.2/celt/opus_custom_demo.c:190:4: warning[-Wanalyzer-malloc-leak]: leak of ‘in’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:105:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:112:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:113:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:120:4: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:128:22: acquire_memory: allocated here
opus-1.5.2/celt/opus_custom_demo.c:131:11: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:134:13: branch_true: ...to here
opus-1.5.2/celt/opus_custom_demo.c:135:10: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:137:13: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:190:4: throw: if ‘opus_custom_encoder_destroy’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:190:4: danger: ‘in’ leaks here; was allocated at [(15)](sarif:/runs/0/results/61/codeFlows/0/threadFlows/0/locations/14)
#  188|      PRINT_MIPS(stderr);
#  189|   
#  190|->    opus_custom_encoder_destroy(enc);
#  191|      opus_custom_decoder_destroy(dec);
#  192|      fclose(fin);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
opus-1.5.2/celt/opus_custom_demo.c:191:4: warning[-Wanalyzer-malloc-leak]: leak of ‘in’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:105:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:112:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:113:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:120:4: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:128:22: acquire_memory: allocated here
opus-1.5.2/celt/opus_custom_demo.c:131:11: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:134:13: branch_true: ...to here
opus-1.5.2/celt/opus_custom_demo.c:135:10: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:137:13: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:191:4: throw: if ‘opus_custom_decoder_destroy’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:191:4: danger: ‘in’ leaks here; was allocated at [(15)](sarif:/runs/0/results/62/codeFlows/0/threadFlows/0/locations/14)
#  189|   
#  190|      opus_custom_encoder_destroy(enc);
#  191|->    opus_custom_decoder_destroy(dec);
#  192|      fclose(fin);
#  193|      fclose(fout);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def15]
opus-1.5.2/celt/opus_custom_demo.c:194:4: warning[-Wanalyzer-malloc-leak]: leak of ‘in’
opus-1.5.2/celt/opus_custom_demo.c:62:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:70:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:74:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:80:23: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:81:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:88:17: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:90:7: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:97:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:104:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:105:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:112:10: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:113:7: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:120:4: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:128:22: acquire_memory: allocated here
opus-1.5.2/celt/opus_custom_demo.c:131:11: branch_true: following ‘true’ branch...
opus-1.5.2/celt/opus_custom_demo.c:134:13: branch_true: ...to here
opus-1.5.2/celt/opus_custom_demo.c:135:10: branch_false: following ‘false’ branch...
opus-1.5.2/celt/opus_custom_demo.c:137:13: branch_false: ...to here
opus-1.5.2/celt/opus_custom_demo.c:194:4: throw: if ‘opus_custom_mode_destroy’ throws an exception...
opus-1.5.2/celt/opus_custom_demo.c:194:4: danger: ‘in’ leaks here; was allocated at [(15)](sarif:/runs/0/results/63/codeFlows/0/threadFlows/0/locations/14)
#  192|      fclose(fin);
#  193|      fclose(fout);
#  194|->    opus_custom_mode_destroy(mode);
#  195|      free(in);
#  196|      free(out);

Error: CPPCHECK_WARNING (CWE-457): [#def16]
opus-1.5.2/celt/pitch.c:356: warning[uninitvar]: Uninitialized variable: x_lp4
#  354|      maxcorr =
#  355|   #endif
#  356|->    celt_pitch_xcorr(x_lp4, y_lp4, xcorr, len>>2, max_pitch>>2, arch);
#  357|   
#  358|      find_best_pitch(xcorr, y_lp4, len>>2, max_pitch>>2, best_pitch

Error: CPPCHECK_WARNING (CWE-457): [#def17]
opus-1.5.2/celt/pitch.c:356: warning[uninitvar]: Uninitialized variable: y_lp4
#  354|      maxcorr =
#  355|   #endif
#  356|->    celt_pitch_xcorr(x_lp4, y_lp4, xcorr, len>>2, max_pitch>>2, arch);
#  357|   
#  358|      find_best_pitch(xcorr, y_lp4, len>>2, max_pitch>>2, best_pitch

Error: CPPCHECK_WARNING (CWE-457): [#def18]
opus-1.5.2/src/opus_encoder.c:2033: warning[uninitvar]: Uninitialized variable: pcm_silk
# 2031|                   pcm_silk[i] = FLOAT2INT16(st->delay_buffer[i]);
# 2032|   #endif
# 2033|->             silk_Encode( silk_enc, &st->silk_mode, pcm_silk, st->encoder_buffer, NULL, &zero, prefill, activity );
# 2034|               /* Prevent a second switch in the real encode call. */
# 2035|               st->silk_mode.opusCanSwitch = 0;

Error: GCC_ANALYZER_WARNING (CWE-404): [#def19]
opus-1.5.2/src/opus_encoder.c:2984:12: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
opus-1.5.2/src/opus_encoder.c:2540:5: acquire_resource: 'va_start' called here
opus-1.5.2/src/opus_encoder.c:2984:12: throw: if 'silk_InitEncoder' throws an exception...
opus-1.5.2/src/opus_encoder.c:2984:12: danger: missing call to 'va_end' to match 'va_start' at [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
# 2982|   
# 2983|              celt_encoder_ctl(celt_enc, OPUS_RESET_STATE);
# 2984|->            silk_InitEncoder( silk_enc, st->arch, &dummy );
# 2985|   #ifdef ENABLE_DRED
# 2986|              /* Initialize DRED Encoder */

Error: GCC_ANALYZER_WARNING (CWE-404): [#def20]
opus-1.5.2/src/opus_multistream_encoder.c:70:19: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
opus-1.5.2/src/opus_multistream_encoder.c:1316:5: enter_function: entry to 'opus_multistream_encoder_ctl'
opus-1.5.2/src/opus_multistream_encoder.c:1320:4: acquire_resource: 'va_start' called here
opus-1.5.2/src/opus_multistream_encoder.c:1321:10: call_function: calling 'opus_multistream_encoder_ctl_va_list' from 'opus_multistream_encoder_ctl'
#   68|      int coupled_size, mono_size;
#   69|   
#   70|->    coupled_size = opus_encoder_get_size(2);
#   71|      mono_size = opus_encoder_get_size(1);
#   72|      ptr = (char*)st + align(sizeof(OpusMSEncoder));

Error: GCC_ANALYZER_WARNING (CWE-404): [#def21]
opus-1.5.2/src/opus_multistream_encoder.c:71:16: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
opus-1.5.2/src/opus_multistream_encoder.c:1316:5: enter_function: entry to 'opus_multistream_encoder_ctl'
opus-1.5.2/src/opus_multistream_encoder.c:1320:4: acquire_resource: 'va_start' called here
opus-1.5.2/src/opus_multistream_encoder.c:1321:10: call_function: calling 'opus_multistream_encoder_ctl_va_list' from 'opus_multistream_encoder_ctl'
#   69|   
#   70|      coupled_size = opus_encoder_get_size(2);
#   71|->    mono_size = opus_encoder_get_size(1);
#   72|      ptr = (char*)st + align(sizeof(OpusMSEncoder));
#   73|      for (s=0;s<st->layout.nb_streams;s++)

Error: GCC_ANALYZER_WARNING (CWE-404): [#def22]
opus-1.5.2/src/opus_multistream_encoder.c:90:19: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
opus-1.5.2/src/opus_multistream_encoder.c:1316:5: enter_function: entry to 'opus_multistream_encoder_ctl'
opus-1.5.2/src/opus_multistream_encoder.c:1320:4: acquire_resource: 'va_start' called here
opus-1.5.2/src/opus_multistream_encoder.c:1321:10: call_function: calling 'opus_multistream_encoder_ctl_va_list' from 'opus_multistream_encoder_ctl'
#   88|      int coupled_size, mono_size;
#   89|   
#   90|->    coupled_size = opus_encoder_get_size(2);
#   91|      mono_size = opus_encoder_get_size(1);
#   92|      ptr = (char*)st + align(sizeof(OpusMSEncoder));

Error: GCC_ANALYZER_WARNING (CWE-404): [#def23]
opus-1.5.2/src/opus_multistream_encoder.c:91:16: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
opus-1.5.2/src/opus_multistream_encoder.c:1316:5: enter_function: entry to 'opus_multistream_encoder_ctl'
opus-1.5.2/src/opus_multistream_encoder.c:1320:4: acquire_resource: 'va_start' called here
opus-1.5.2/src/opus_multistream_encoder.c:1321:10: call_function: calling 'opus_multistream_encoder_ctl_va_list' from 'opus_multistream_encoder_ctl'
#   89|   
#   90|      coupled_size = opus_encoder_get_size(2);
#   91|->    mono_size = opus_encoder_get_size(1);
#   92|      ptr = (char*)st + align(sizeof(OpusMSEncoder));
#   93|      for (s=0;s<st->layout.nb_streams;s++)

Error: GCC_ANALYZER_WARNING (CWE-404): [#def24]
opus-1.5.2/src/opus_multistream_encoder.c:1124:19: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
opus-1.5.2/src/opus_multistream_encoder.c:1316:5: enter_function: entry to 'opus_multistream_encoder_ctl'
opus-1.5.2/src/opus_multistream_encoder.c:1320:4: acquire_resource: 'va_start' called here
opus-1.5.2/src/opus_multistream_encoder.c:1321:10: call_function: calling 'opus_multistream_encoder_ctl_va_list' from 'opus_multistream_encoder_ctl'
# 1122|      int ret = OPUS_OK;
# 1123|   
# 1124|->    coupled_size = opus_encoder_get_size(2);
# 1125|      mono_size = opus_encoder_get_size(1);
# 1126|      ptr = (char*)st + align(sizeof(OpusMSEncoder));

Error: GCC_ANALYZER_WARNING (CWE-404): [#def25]
opus-1.5.2/src/opus_multistream_encoder.c:1125:16: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
opus-1.5.2/src/opus_multistream_encoder.c:1316:5: enter_function: entry to 'opus_multistream_encoder_ctl'
opus-1.5.2/src/opus_multistream_encoder.c:1320:4: acquire_resource: 'va_start' called here
opus-1.5.2/src/opus_multistream_encoder.c:1321:10: call_function: calling 'opus_multistream_encoder_ctl_va_list' from 'opus_multistream_encoder_ctl'
# 1123|   
# 1124|      coupled_size = opus_encoder_get_size(2);
# 1125|->    mono_size = opus_encoder_get_size(1);
# 1126|      ptr = (char*)st + align(sizeof(OpusMSEncoder));
# 1127|      switch (request)

Error: CPPCHECK_WARNING (CWE-457): [#def26]
opus-1.5.2/tests/test_opus_extensions.c:327: warning[uninitvar]: Uninitialized variable: payload
#  325|            payload[j] = fast_rand()&0xFF;
#  326|         nb_ext = fast_rand()%(MAX_NB_EXTENSIONS+1);
#  327|->       result = opus_packet_extensions_parse(payload, len, ext_out, &nb_ext);
#  328|         expect_true(result == OPUS_OK || result == OPUS_BUFFER_TOO_SMALL || result == OPUS_INVALID_PACKET, "expected OPUS_OK, OPUS_BUFFER_TOO_SMALL or OPUS_INVALID_PACKET");
#  329|         /* Even if parsing fails, check that the extensions that got extracted make sense. */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def27]
opus-1.5.2/tests/test_opus_projection.c:124:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc(120)’
opus-1.5.2/tests/test_opus_projection.c:81:6: enter_function: entry to ‘test_simple_matrix’
opus-1.5.2/tests/test_opus_projection.c:103:31: call_function: inlined call to ‘opus_alloc’ from ‘test_simple_matrix’
opus-1.5.2/tests/test_opus_projection.c:110:6: branch_false: following ‘false’ branch...
opus-1.5.2/tests/test_opus_projection.c:113:36: branch_false: ...to here
opus-1.5.2/tests/test_opus_projection.c:119:15: branch_true: following ‘true’ branch (when ‘i != 30’)...
opus-1.5.2/tests/test_opus_projection.c:124:34: branch_true: ...to here
opus-1.5.2/tests/test_opus_projection.c:124:5: danger: ‘malloc(120) + (long unsigned int)i * 4’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/2)
#  122|       input_val16[i] = input_int16[i];
#  123|   #else
#  124|->     input_val16[i] = (1/32768.f)*input_int16[i];
#  125|   #endif
#  126|     }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def28]
opus-1.5.2/tests/test_opus_projection.c:130:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc(160)’
opus-1.5.2/tests/test_opus_projection.c:81:6: enter_function: entry to ‘test_simple_matrix’
opus-1.5.2/tests/test_opus_projection.c:105:32: call_function: inlined call to ‘opus_alloc’ from ‘test_simple_matrix’
opus-1.5.2/tests/test_opus_projection.c:110:6: branch_false: following ‘false’ branch...
opus-1.5.2/tests/test_opus_projection.c:113:36: branch_false: ...to here
opus-1.5.2/tests/test_opus_projection.c:119:15: branch_true: following ‘true’ branch (when ‘i != 30’)...
opus-1.5.2/tests/test_opus_projection.c:124:34: branch_true: ...to here
opus-1.5.2/tests/test_opus_projection.c:119:15: branch_true: following ‘true’ branch (when ‘i != 30’)...
opus-1.5.2/tests/test_opus_projection.c:124:34: branch_true: ...to here
opus-1.5.2/tests/test_opus_projection.c:129:15: branch_true: following ‘true’ branch (when ‘i != 40’)...
opus-1.5.2/tests/test_opus_projection.c:130:17: branch_true: ...to here
opus-1.5.2/tests/test_opus_projection.c:130:5: danger: ‘malloc(160) + (long unsigned int)i * 4’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/2)
#  128|     /* _in_short */
#  129|     for (i = 0; i < SIMPLE_MATRIX_OUTPUT_SIZE; i++)
#  130|->     output_val16[i] = 0;
#  131|     for (i = 0; i < simple_matrix->rows; i++)
#  132|     {

Scan Properties

analyzer-version-clippy1.92.0
analyzer-version-cppcheck2.19.1
analyzer-version-gcc16.0.0
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.92.0
diffbase-analyzer-version-cppcheck2.19.1
diffbase-analyzer-version-gcc16.0.0
diffbase-analyzer-version-gcc-analyzer16.0.0
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-110.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-nameopus-1.6-1.fc44
diffbase-store-results-to/tmp/tmp4huqfjwa/opus-1.6-1.fc44.tar.xz
diffbase-time-created2026-01-08 20:03:55
diffbase-time-finished2026-01-08 20:07:24
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmp4huqfjwa/opus-1.6-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp4huqfjwa/opus-1.6-1.fc44.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-110.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-nameopus-1.5.2-3.fc43
store-results-to/tmp/tmp3xbmy9bq/opus-1.5.2-3.fc43.tar.xz
time-created2026-01-08 19:59:27
time-finished2026-01-08 20:03:20
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmp3xbmy9bq/opus-1.5.2-3.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp3xbmy9bq/opus-1.5.2-3.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9