Error: GCC_ANALYZER_WARNING (CWE-401): [#def1] file-5.46/src/apprentice.c:1336:25: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1519:1: enter_function: entry to 'apprentice_load' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1595:17: call_function: calling 'load_1' from 'apprentice_load' # 1334| if (f == NULL) { # 1335| if (errno != ENOENT) # 1336|-> file_error(ms, errno, "cannot read magic file `%s'", # 1337| fn); # 1338| (*errs)++; Error: GCC_ANALYZER_WARNING (CWE-401): [#def2] file-5.46/src/apprentice.c:1548:23: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1548:23: danger: 'map' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0) # 1546| /* load directory or file */ # 1547| if (stat(fn, &st) == 0 && S_ISDIR(st.st_mode)) { # 1548|-> dir = opendir(fn); # 1549| if (!dir) { # 1550| errs++; Error: GCC_ANALYZER_WARNING (CWE-401): [#def3] file-5.46/src/apprentice.c:1553:29: warning[-Wanalyzer-malloc-leak]: leak of 'filearr' file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1556:28: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1563:29: branch_false: ...to here file-5.46/src/apprentice.c:1567:28: branch_true: following 'true' branch (when 'files >= maxfiles')... file-5.46/src/apprentice.c:1570:44: branch_true: ...to here file-5.46/src/apprentice.c:1572:36: branch_false: following 'false' branch (when 'nfilearr' is non-NULL)... file-5.46/src/apprentice.c:1582:33: branch_false: ...to here file-5.46/src/apprentice.c:1553:29: danger: 'filearr' leaks here; was allocated at [(13)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/12) # 1551| goto out; # 1552| } # 1553|-> while ((d = readdir(dir)) != NULL) { # 1554| if (d->d_name[0] == '.') # 1555| continue; Error: GCC_ANALYZER_WARNING (CWE-401): [#def4] file-5.46/src/apprentice.c:1553:29: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:29: danger: 'map' leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0) # 1551| goto out; # 1552| } # 1553|-> while ((d = readdir(dir)) != NULL) { # 1554| if (d->d_name[0] == '.') # 1555| continue; Error: GCC_ANALYZER_WARNING (CWE-401): [#def5] file-5.46/src/apprentice.c:1553:29: warning[-Wanalyzer-malloc-leak]: leak of 'opendir(fn)' file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1548:23: acquire_memory: allocated here file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:29: danger: 'opendir(fn)' leaks here; was allocated at [(5)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/4) # 1551| goto out; # 1552| } # 1553|-> while ((d = readdir(dir)) != NULL) { # 1554| if (d->d_name[0] == '.') # 1555| continue; Error: GCC_ANALYZER_WARNING (CWE-401): [#def6] file-5.46/src/apprentice.c:1557:33: warning[-Wanalyzer-malloc-leak]: leak of 'filearr' file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1556:28: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1563:29: branch_false: ...to here file-5.46/src/apprentice.c:1567:28: branch_true: following 'true' branch (when 'files >= maxfiles')... file-5.46/src/apprentice.c:1570:44: branch_true: ...to here file-5.46/src/apprentice.c:1572:36: branch_false: following 'false' branch (when 'nfilearr' is non-NULL)... file-5.46/src/apprentice.c:1582:33: branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1554:28: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1556:57: branch_false: ...to here file-5.46/src/apprentice.c:1556:28: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1558:37: branch_true: ...to here file-5.46/src/apprentice.c:1557:33: danger: 'filearr' leaks here; was allocated at [(13)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/12) # 1555| continue; # 1556| if (asprintf(&mfn, "%s/%s", fn, d->d_name) < 0) { # 1557|-> file_oomem(ms, # 1558| strlen(fn) + strlen(d->d_name) + 2); # 1559| errs++; Error: GCC_ANALYZER_WARNING (CWE-401): [#def7] file-5.46/src/apprentice.c:1557:33: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1557:33: danger: 'map' leaks here; was allocated at [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0) # 1555| continue; # 1556| if (asprintf(&mfn, "%s/%s", fn, d->d_name) < 0) { # 1557|-> file_oomem(ms, # 1558| strlen(fn) + strlen(d->d_name) + 2); # 1559| errs++; Error: GCC_ANALYZER_WARNING (CWE-401): [#def8] file-5.46/src/apprentice.c:1560:33: warning[-Wanalyzer-malloc-leak]: leak of 'filearr' file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1556:28: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1563:29: branch_false: ...to here file-5.46/src/apprentice.c:1567:28: branch_true: following 'true' branch (when 'files >= maxfiles')... file-5.46/src/apprentice.c:1570:44: branch_true: ...to here file-5.46/src/apprentice.c:1572:36: branch_false: following 'false' branch (when 'nfilearr' is non-NULL)... file-5.46/src/apprentice.c:1582:33: branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1554:28: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1556:57: branch_false: ...to here file-5.46/src/apprentice.c:1556:28: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1558:37: branch_true: ...to here file-5.46/src/apprentice.c:1560:33: danger: 'filearr' leaks here; was allocated at [(13)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/12) # 1558| strlen(fn) + strlen(d->d_name) + 2); # 1559| errs++; # 1560|-> closedir(dir); # 1561| goto out; # 1562| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def9] file-5.46/src/apprentice.c:1560:33: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1560:33: danger: 'map' leaks here; was allocated at [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0) # 1558| strlen(fn) + strlen(d->d_name) + 2); # 1559| errs++; # 1560|-> closedir(dir); # 1561| goto out; # 1562| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def10] file-5.46/src/apprentice.c:1574:41: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1556:28: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1563:29: branch_false: ...to here file-5.46/src/apprentice.c:1567:28: branch_true: following 'true' branch (when 'files >= maxfiles')... file-5.46/src/apprentice.c:1570:44: branch_true: ...to here file-5.46/src/apprentice.c:1572:36: branch_true: following 'true' branch (when 'nfilearr' is NULL)... file-5.46/src/apprentice.c:1574:41: branch_true: ...to here file-5.46/src/apprentice.c:1574:41: danger: 'map' leaks here; was allocated at [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0) # 1572| if ((nfilearr = CAST(char **, # 1573| realloc(filearr, mlen))) == NULL) { # 1574|-> file_oomem(ms, mlen); # 1575| free(mfn); # 1576| closedir(dir); Error: GCC_ANALYZER_WARNING (CWE-401): [#def11] file-5.46/src/apprentice.c:1576:41: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1556:28: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1563:29: branch_false: ...to here file-5.46/src/apprentice.c:1567:28: branch_true: following 'true' branch (when 'files >= maxfiles')... file-5.46/src/apprentice.c:1570:44: branch_true: ...to here file-5.46/src/apprentice.c:1572:36: branch_true: following 'true' branch (when 'nfilearr' is NULL)... file-5.46/src/apprentice.c:1574:41: branch_true: ...to here file-5.46/src/apprentice.c:1576:41: danger: 'map' leaks here; was allocated at [(1)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/0) # 1574| file_oomem(ms, mlen); # 1575| free(mfn); # 1576|-> closedir(dir); # 1577| errs++; # 1578| goto out; Error: GCC_ANALYZER_WARNING (CWE-401): [#def12] file-5.46/src/apprentice.c:1584:17: warning[-Wanalyzer-malloc-leak]: leak of 'filearr' file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1556:28: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1563:29: branch_false: ...to here file-5.46/src/apprentice.c:1567:28: branch_true: following 'true' branch (when 'files >= maxfiles')... file-5.46/src/apprentice.c:1570:44: branch_true: ...to here file-5.46/src/apprentice.c:1572:36: branch_false: following 'false' branch (when 'nfilearr' is non-NULL)... file-5.46/src/apprentice.c:1582:33: branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1584:17: branch_false: ...to here file-5.46/src/apprentice.c:1584:17: danger: 'filearr' leaks here; was allocated at [(13)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/12) # 1582| filearr[files++] = mfn; # 1583| } # 1584|-> closedir(dir); # 1585| if (filearr) { # 1586| qsort(filearr, files, sizeof(*filearr), cmpstrp); Error: GCC_ANALYZER_WARNING (CWE-401): [#def13] file-5.46/src/apprentice.c:1584:17: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1584:17: danger: 'map' leaks here; was allocated at [(1)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/0) # 1582| filearr[files++] = mfn; # 1583| } # 1584|-> closedir(dir); # 1585| if (filearr) { # 1586| qsort(filearr, files, sizeof(*filearr), cmpstrp); Error: GCC_ANALYZER_WARNING (CWE-401): [#def14] file-5.46/src/apprentice.c:1586:25: warning[-Wanalyzer-malloc-leak]: leak of 'filearr' file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1556:28: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1563:29: branch_false: ...to here file-5.46/src/apprentice.c:1567:28: branch_true: following 'true' branch (when 'files >= maxfiles')... file-5.46/src/apprentice.c:1570:44: branch_true: ...to here file-5.46/src/apprentice.c:1572:36: branch_false: following 'false' branch (when 'nfilearr' is non-NULL)... file-5.46/src/apprentice.c:1582:33: branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1584:17: branch_false: ...to here file-5.46/src/apprentice.c:1585:20: branch_true: following 'true' branch (when 'filearr' is non-NULL)... file-5.46/src/apprentice.c:1586:25: branch_true: ...to here file-5.46/src/apprentice.c:1586:25: danger: 'filearr' leaks here; was allocated at [(13)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/12) # 1584| closedir(dir); # 1585| if (filearr) { # 1586|-> qsort(filearr, files, sizeof(*filearr), cmpstrp); # 1587| for (i = 0; i < files; i++) { # 1588| load_1(ms, action, filearr[i], &errs, mset); Error: GCC_ANALYZER_WARNING (CWE-401): [#def15] file-5.46/src/apprentice.c:1586:25: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1556:28: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1563:29: branch_false: ...to here file-5.46/src/apprentice.c:1567:28: branch_true: following 'true' branch (when 'files >= maxfiles')... file-5.46/src/apprentice.c:1570:44: branch_true: ...to here file-5.46/src/apprentice.c:1572:36: branch_false: following 'false' branch (when 'nfilearr' is non-NULL)... file-5.46/src/apprentice.c:1582:33: branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1584:17: branch_false: ...to here file-5.46/src/apprentice.c:1585:20: branch_true: following 'true' branch (when 'filearr' is non-NULL)... file-5.46/src/apprentice.c:1586:25: branch_true: ...to here file-5.46/src/apprentice.c:1586:25: danger: 'map' leaks here; was allocated at [(1)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/0) # 1584| closedir(dir); # 1585| if (filearr) { # 1586|-> qsort(filearr, files, sizeof(*filearr), cmpstrp); # 1587| for (i = 0; i < files; i++) { # 1588| load_1(ms, action, filearr[i], &errs, mset); Error: GCC_ANALYZER_WARNING (CWE-401): [#def16] file-5.46/src/apprentice.c:2056:21: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1519:1: enter_function: entry to 'apprentice_load' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1595:17: call_function: calling 'load_1' from 'apprentice_load' # 2054| #ifdef ENABLE_CONDITIONALS # 2055| if (cont_level == 0 || cont_level > last_cont_level) # 2056|-> if (file_check_mem(ms, cont_level) == -1) # 2057| return -1; # 2058| last_cont_level = cont_level; Error: GCC_ANALYZER_WARNING (CWE-401): [#def17] file-5.46/src/apprentice.c:2062:25: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1519:1: enter_function: entry to 'apprentice_load' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1595:17: call_function: calling 'load_1' from 'apprentice_load' # 2060| if (cont_level != 0) { # 2061| if (me->mp == NULL) { # 2062|-> file_magerror(ms, "No current entry for continuation"); # 2063| return -1; # 2064| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def18] file-5.46/src/apprentice.c:2066:25: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1519:1: enter_function: entry to 'apprentice_load' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1547:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1549:20: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1554:29: branch_true: ...to here file-5.46/src/apprentice.c:1556:28: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1563:29: branch_false: ...to here file-5.46/src/apprentice.c:1567:28: branch_true: following 'true' branch (when 'files >= maxfiles')... file-5.46/src/apprentice.c:1570:44: branch_true: ...to here file-5.46/src/apprentice.c:1572:36: branch_false: following 'false' branch (when 'nfilearr' is non-NULL)... file-5.46/src/apprentice.c:1582:33: branch_false: ...to here file-5.46/src/apprentice.c:1553:24: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1584:17: branch_false: ...to here file-5.46/src/apprentice.c:1585:20: branch_true: following 'true' branch (when 'filearr' is non-NULL)... file-5.46/src/apprentice.c:1586:25: branch_true: ...to here file-5.46/src/apprentice.c:1587:37: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1588:59: branch_true: ...to here file-5.46/src/apprentice.c:1588:33: call_function: calling 'load_1' from 'apprentice_load' # 2064| } # 2065| if (me->cont_count == 0) { # 2066|-> file_magerror(ms, "Continuations present with 0 count"); # 2067| return -1; # 2068| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def19] file-5.46/src/apprentice.c:2094:25: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:1519:1: enter_function: entry to 'apprentice_load' file-5.46/src/apprentice.c:1535:20: acquire_memory: allocated here file-5.46/src/apprentice.c:1535:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:1540:9: branch_false: ...to here file-5.46/src/apprentice.c:1595:17: call_function: calling 'load_1' from 'apprentice_load' # 2092| return 1; # 2093| if ((m = CAST(struct magic *, malloc(len))) == NULL) { # 2094|-> file_oomem(ms, len); # 2095| return -1; # 2096| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def20] file-5.46/src/apprentice.c:2124:25: warning[-Wanalyzer-malloc-leak]: leak of 'me.mp' file-5.46/src/apprentice.c:1325:1: enter_function: entry to 'load_1' file-5.46/src/apprentice.c:1334:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1342:9: branch_false: ...to here file-5.46/src/apprentice.c:1344:28: branch_true: following 'true' branch... file-5.46/src/apprentice.c:1346:21: branch_true: ...to here file-5.46/src/apprentice.c:1346:20: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1348:20: branch_false: ...to here file-5.46/src/apprentice.c:1348:20: branch_false: following 'false' branch... file-5.46/src/apprentice.c:1350:25: branch_false: ...to here file-5.46/src/apprentice.c:1392:33: call_function: calling 'parse' from 'load_1' # 2122| if (m->cont_level == 0 && (m->flag & (OFFADD | INDIROFFADD))) { # 2123| if (ms->flags & MAGIC_CHECK) # 2124|-> file_magwarn(ms, "relative offset at level 0"); # 2125| return -1; # 2126| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def21] file-5.46/src/apprentice.c:3314:19: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3295:1: enter_function: entry to 'apprentice_map' file-5.46/src/apprentice.c:3304:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3304:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3310:18: branch_false: ...to here file-5.46/src/apprentice.c:3310:18: call_function: calling 'mkdbname' from 'apprentice_map' file-5.46/src/apprentice.c:3310:18: return_function: returning to 'apprentice_map' from 'mkdbname' file-5.46/src/apprentice.c:3311:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3314:19: branch_false: ...to here file-5.46/src/apprentice.c:3314:19: danger: 'map' leaks here; was allocated at [(2)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/1) # 3312| goto error; # 3313| # 3314|-> if ((fd = open(dbname, O_RDONLY|O_BINARY)) == -1) # 3315| goto error; # 3316| Error: GCC_ANALYZER_WARNING (CWE-401): [#def22] file-5.46/src/apprentice.c:3318:17: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3295:1: enter_function: entry to 'apprentice_map' file-5.46/src/apprentice.c:3304:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3304:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3310:18: branch_false: ...to here file-5.46/src/apprentice.c:3310:18: call_function: calling 'mkdbname' from 'apprentice_map' file-5.46/src/apprentice.c:3310:18: return_function: returning to 'apprentice_map' from 'mkdbname' file-5.46/src/apprentice.c:3311:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3314:19: branch_false: ...to here file-5.46/src/apprentice.c:3314:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3317:13: branch_false: ...to here file-5.46/src/apprentice.c:3317:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:3318:32: branch_true: ...to here file-5.46/src/apprentice.c:3318:17: danger: 'map' leaks here; was allocated at [(2)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/1) # 3316| # 3317| if (fstat(fd, &st) == -1) { # 3318|-> file_error(ms, errno, "cannot stat `%s'", dbname); # 3319| goto error; # 3320| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def23] file-5.46/src/apprentice.c:3322:17: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3295:1: enter_function: entry to 'apprentice_map' file-5.46/src/apprentice.c:3304:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3304:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3310:18: branch_false: ...to here file-5.46/src/apprentice.c:3310:18: call_function: calling 'mkdbname' from 'apprentice_map' file-5.46/src/apprentice.c:3310:18: return_function: returning to 'apprentice_map' from 'mkdbname' file-5.46/src/apprentice.c:3311:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3314:19: branch_false: ...to here file-5.46/src/apprentice.c:3314:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3317:13: branch_false: ...to here file-5.46/src/apprentice.c:3317:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3321:13: branch_false: ...to here file-5.46/src/apprentice.c:3321:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:3322:17: branch_true: ...to here file-5.46/src/apprentice.c:3322:17: danger: 'map' leaks here; was allocated at [(2)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/1) # 3320| } # 3321| if (st.st_size < 8 || st.st_size > maxoff_t()) { # 3322|-> file_error(ms, 0, "file `%s' is too %s", dbname, # 3323| st.st_size < 8 ? "small" : "large"); # 3324| goto error; Error: GCC_ANALYZER_WARNING (CWE-401): [#def24] file-5.46/src/apprentice.c:3332:17: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3295:1: enter_function: entry to 'apprentice_map' file-5.46/src/apprentice.c:3304:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3304:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3310:18: branch_false: ...to here file-5.46/src/apprentice.c:3310:18: call_function: calling 'mkdbname' from 'apprentice_map' file-5.46/src/apprentice.c:3310:18: return_function: returning to 'apprentice_map' from 'mkdbname' file-5.46/src/apprentice.c:3311:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3314:19: branch_false: ...to here file-5.46/src/apprentice.c:3314:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3317:13: branch_false: ...to here file-5.46/src/apprentice.c:3317:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3321:13: branch_false: ...to here file-5.46/src/apprentice.c:3321:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3327:20: branch_false: ...to here file-5.46/src/apprentice.c:3330:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:3332:32: branch_true: ...to here file-5.46/src/apprentice.c:3332:17: danger: 'map' leaks here; was allocated at [(2)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/1) # 3330| if ((map->p = mmap(0, CAST(size_t, st.st_size), PROT_READ|PROT_WRITE, # 3331| MAP_PRIVATE|MAP_FILE, fd, CAST(off_t, 0))) == MAP_FAILED) { # 3332|-> file_error(ms, errno, "cannot map `%s'", dbname); # 3333| goto error; # 3334| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def25] file-5.46/src/apprentice.c:3346:15: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3295:1: enter_function: entry to 'apprentice_map' file-5.46/src/apprentice.c:3304:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3304:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3310:18: branch_false: ...to here file-5.46/src/apprentice.c:3310:18: call_function: calling 'mkdbname' from 'apprentice_map' file-5.46/src/apprentice.c:3310:18: return_function: returning to 'apprentice_map' from 'mkdbname' file-5.46/src/apprentice.c:3311:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3314:19: branch_false: ...to here file-5.46/src/apprentice.c:3314:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3317:13: branch_false: ...to here file-5.46/src/apprentice.c:3317:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3321:13: branch_false: ...to here file-5.46/src/apprentice.c:3321:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3327:20: branch_false: ...to here file-5.46/src/apprentice.c:3330:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3346:15: branch_false: ...to here file-5.46/src/apprentice.c:3346:15: danger: 'map' leaks here; was allocated at [(2)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/1) # 3344| } # 3345| #endif # 3346|-> (void)close(fd); # 3347| fd = -1; # 3348| Error: GCC_ANALYZER_WARNING (CWE-401): [#def26] file-5.46/src/apprentice.c:3354:17: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3295:1: enter_function: entry to 'apprentice_map' file-5.46/src/apprentice.c:3304:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3304:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3310:18: branch_false: ...to here file-5.46/src/apprentice.c:3310:18: call_function: calling 'mkdbname' from 'apprentice_map' file-5.46/src/apprentice.c:3310:18: return_function: returning to 'apprentice_map' from 'mkdbname' file-5.46/src/apprentice.c:3311:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3314:19: branch_false: ...to here file-5.46/src/apprentice.c:3314:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3317:13: branch_false: ...to here file-5.46/src/apprentice.c:3317:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3321:13: branch_false: ...to here file-5.46/src/apprentice.c:3321:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3327:20: branch_false: ...to here file-5.46/src/apprentice.c:3330:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3346:15: branch_false: ...to here file-5.46/src/apprentice.c:3349:13: call_function: calling 'check_buffer' from 'apprentice_map' file-5.46/src/apprentice.c:3349:13: return_function: returning to 'apprentice_map' from 'check_buffer' file-5.46/src/apprentice.c:3349:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3353:30: branch_false: ...to here file-5.46/src/apprentice.c:3353:12: branch_true: following 'true' branch... file-5.46/src/apprentice.c:3354:32: branch_true: ...to here file-5.46/src/apprentice.c:3354:17: danger: 'map' leaks here; was allocated at [(2)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/1) # 3352| #ifdef QUICK # 3353| if (mprotect(map->p, CAST(size_t, st.st_size), PROT_READ) == -1) { # 3354|-> file_error(ms, errno, "cannot mprotect `%s'", dbname); # 3355| goto error; # 3356| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def27] file-5.46/src/apprentice.c:3364:23: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3295:1: enter_function: entry to 'apprentice_map' file-5.46/src/apprentice.c:3304:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3304:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3310:18: branch_false: ...to here file-5.46/src/apprentice.c:3310:18: call_function: calling 'mkdbname' from 'apprentice_map' file-5.46/src/apprentice.c:3310:18: return_function: returning to 'apprentice_map' from 'mkdbname' file-5.46/src/apprentice.c:3311:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3314:19: branch_false: ...to here file-5.46/src/apprentice.c:3314:12: branch_false: following 'false' branch... file-5.46/src/apprentice.c:3317:13: branch_false: ...to here file-5.46/src/apprentice.c:3364:23: danger: 'map' leaks here; was allocated at [(2)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/1) # 3362| error: # 3363| if (fd != -1) # 3364|-> (void)close(fd); # 3365| apprentice_unmap(map); # 3366| free(dbname); Error: GCC_ANALYZER_WARNING (CWE-401): [#def28] file-5.46/src/apprentice.c:3380:17: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3272:1: enter_function: entry to 'apprentice_buf' file-5.46/src/apprentice.c:3276:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3276:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3280:9: branch_false: ...to here file-5.46/src/apprentice.c:3283:13: call_function: calling 'check_buffer' from 'apprentice_buf' # 3378| entries = CAST(uint32_t, map->len / sizeof(struct magic)); # 3379| if (entries < MAGIC_SETS) { # 3380|-> file_error(ms, 0, "Too few magic entries %u in `%s'", # 3381| entries, dbname); # 3382| return -1; Error: GCC_ANALYZER_WARNING (CWE-401): [#def29] file-5.46/src/apprentice.c:3385:17: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3272:1: enter_function: entry to 'apprentice_buf' file-5.46/src/apprentice.c:3276:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3276:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3280:9: branch_false: ...to here file-5.46/src/apprentice.c:3283:13: call_function: calling 'check_buffer' from 'apprentice_buf' # 3383| } # 3384| if ((entries * sizeof(struct magic)) != map->len) { # 3385|-> file_error(ms, 0, "Size of `%s' %" SIZE_T_FORMAT "u is not " # 3386| "a multiple of %" SIZE_T_FORMAT "u", # 3387| dbname, map->len, sizeof(struct magic)); Error: GCC_ANALYZER_WARNING (CWE-401): [#def30] file-5.46/src/apprentice.c:3394:25: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3272:1: enter_function: entry to 'apprentice_buf' file-5.46/src/apprentice.c:3276:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3276:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3280:9: branch_false: ...to here file-5.46/src/apprentice.c:3283:13: call_function: calling 'check_buffer' from 'apprentice_buf' # 3392| if (*ptr != MAGICNO) { # 3393| if (swap4(*ptr) != MAGICNO) { # 3394|-> file_error(ms, 0, "bad magic in `%s'", dbname); # 3395| return -1; # 3396| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def31] file-5.46/src/apprentice.c:3405:17: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3272:1: enter_function: entry to 'apprentice_buf' file-5.46/src/apprentice.c:3276:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3276:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3280:9: branch_false: ...to here file-5.46/src/apprentice.c:3283:13: call_function: calling 'check_buffer' from 'apprentice_buf' # 3403| version = ptr[1]; # 3404| if (version != VERSIONNO) { # 3405|-> file_error(ms, 0, "File %s supports only version %d magic " # 3406| "files. `%s' is version %d", VERSION, # 3407| VERSIONNO, dbname, version); Error: GCC_ANALYZER_WARNING (CWE-401): [#def32] file-5.46/src/apprentice.c:3422:17: warning[-Wanalyzer-malloc-leak]: leak of 'map' file-5.46/src/apprentice.c:3272:1: enter_function: entry to 'apprentice_buf' file-5.46/src/apprentice.c:3276:20: acquire_memory: allocated here file-5.46/src/apprentice.c:3276:12: branch_false: following 'false' branch (when 'map' is non-NULL)... file-5.46/src/apprentice.c:3280:9: branch_false: ...to here file-5.46/src/apprentice.c:3283:13: call_function: calling 'check_buffer' from 'apprentice_buf' # 3420| } # 3421| if (entries != nentries + 1) { # 3422|-> file_error(ms, 0, "Inconsistent entries in `%s' %u != %u", # 3423| dbname, entries, nentries + 1); # 3424| return -1; Error: GCC_ANALYZER_WARNING (CWE-401): [#def33] file-5.46/src/ascmagic.c:155:17: warning[-Wanalyzer-malloc-leak]: leak of 'utf8_buf' file-5.46/src/ascmagic.c:105:1: enter_function: entry to 'file_ascmagic_with_encoding' file-5.46/src/ascmagic.c:136:12: branch_false: following 'false' branch (when 'nbytes > 1')... file-5.46/src/ascmagic.c:141:12: branch_false: ...to here file-5.46/src/ascmagic.c:141:12: branch_true: following 'true' branch... file-5.46/src/ascmagic.c:146:33: acquire_memory: allocated here file-5.46/src/ascmagic.c:146:20: branch_false: following 'false' branch (when 'utf8_buf' is non-NULL)... file-5.46/src/ascmagic.c:150:33: branch_false: ...to here file-5.46/src/ascmagic.c:150:33: call_function: calling 'encode_utf8' from 'file_ascmagic_with_encoding' file-5.46/src/ascmagic.c:150:33: return_function: returning to 'file_ascmagic_with_encoding' from 'encode_utf8' file-5.46/src/ascmagic.c:150:20: branch_false: following 'false' branch... file-5.46/src/ascmagic.c:156:21: branch_false: ...to here file-5.46/src/ascmagic.c:155:17: danger: 'utf8_buf' leaks here; was allocated at [(6)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/5) # 153| goto done; # 154| } # 155|-> buffer_init(&bb, b->fd, &b->st, utf8_buf, # 156| CAST(size_t, utf8_end - utf8_buf)); # 157| Error: GCC_ANALYZER_WARNING (CWE-401): [#def34] file-5.46/src/ascmagic.c:158:27: warning[-Wanalyzer-malloc-leak]: leak of 'utf8_buf' file-5.46/src/ascmagic.c:71:1: enter_function: entry to 'file_ascmagic' file-5.46/src/ascmagic.c:92:12: branch_false: following 'false' branch... file-5.46/src/ascmagic.c:96:22: branch_false: ...to here file-5.46/src/ascmagic.c:96:22: call_function: calling 'file_ascmagic_with_encoding' from 'file_ascmagic' # 156| CAST(size_t, utf8_end - utf8_buf)); # 157| # 158|-> if ((rv = file_softmagic(ms, &bb, NULL, NULL, # 159| TEXTTEST, text)) == 0) # 160| rv = -1; Error: GCC_ANALYZER_WARNING (CWE-775): [#def35] file-5.46/src/compress.c:561:15: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'fd' file-5.46/src/compress.c:527:12: branch_false: following 'false' branch... file-5.46/src/compress.c:533:13: branch_false: ...to here file-5.46/src/compress.c:533:12: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/compress.c:557:19: acquire_resource: opened here file-5.46/src/compress.c:557:12: branch_false: following 'false' branch (when 'fd != -1')... file-5.46/src/compress.c:561:15: branch_false: ...to here file-5.46/src/compress.c:561:15: danger: 'fd' leaks here; was opened at [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6) # 559| return -1; # 560| } # 561|-> (void)close(tfd); # 562| if (lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1)) { # 563| file_badseek(ms); Error: GCC_ANALYZER_WARNING (CWE-401): [#def36] file-5.46/src/compress.c:928:16: warning[-Wanalyzer-malloc-leak]: leak of 'newbuf' file-5.46/src/compress.c:283:1: enter_function: entry to 'file_zmagic' file-5.46/src/compress.c:297:12: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/compress.c:300:21: branch_true: following 'true' branch... file-5.46/src/compress.c:302:30: branch_true: ...to here file-5.46/src/compress.c:302:20: branch_false: following 'false' branch... file-5.46/src/compress.c:304:20: branch_false: ...to here file-5.46/src/compress.c:304:20: branch_false: following 'false' branch... file-5.46/src/compress.c:307:30: branch_false: ...to here file-5.46/src/compress.c:311:20: branch_false: following 'false' branch (when 'zm != 0')... file-5.46/src/compress.c:315:20: branch_false: ...to here file-5.46/src/compress.c:315:20: branch_true: following 'true' branch (when 'sa_saved == 0')... file-5.46/src/compress.c:318:25: branch_true: ...to here file-5.46/src/compress.c:325:23: call_function: calling 'uncompressbuf' from 'file_zmagic' # 926| if (fd[i] == -1) # 927| return; # 928|-> (void) close(fd[i]); # 929| fd[i] = -1; # 930| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def37] file-5.46/src/compress.c:1152:15: warning[-Wanalyzer-malloc-leak]: leak of 'newbuf' file-5.46/src/compress.c:283:1: enter_function: entry to 'file_zmagic' file-5.46/src/compress.c:297:12: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/compress.c:300:21: branch_true: following 'true' branch... file-5.46/src/compress.c:302:30: branch_true: ...to here file-5.46/src/compress.c:302:20: branch_false: following 'false' branch... file-5.46/src/compress.c:304:20: branch_false: ...to here file-5.46/src/compress.c:304:20: branch_false: following 'false' branch... file-5.46/src/compress.c:307:30: branch_false: ...to here file-5.46/src/compress.c:311:20: branch_false: following 'false' branch (when 'zm != 0')... file-5.46/src/compress.c:315:20: branch_false: ...to here file-5.46/src/compress.c:315:20: branch_true: following 'true' branch (when 'sa_saved == 0')... file-5.46/src/compress.c:318:25: branch_true: ...to here file-5.46/src/compress.c:325:23: call_function: calling 'uncompressbuf' from 'file_zmagic' # 1150| } # 1151| # 1152|-> (void)fflush(stdout); # 1153| (void)fflush(stderr); # 1154| Error: GCC_ANALYZER_WARNING (CWE-401): [#def38] file-5.46/src/compress.c:1153:15: warning[-Wanalyzer-malloc-leak]: leak of 'newbuf' file-5.46/src/compress.c:283:1: enter_function: entry to 'file_zmagic' file-5.46/src/compress.c:297:12: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/compress.c:300:21: branch_true: following 'true' branch... file-5.46/src/compress.c:302:30: branch_true: ...to here file-5.46/src/compress.c:302:20: branch_false: following 'false' branch... file-5.46/src/compress.c:304:20: branch_false: ...to here file-5.46/src/compress.c:304:20: branch_false: following 'false' branch... file-5.46/src/compress.c:307:30: branch_false: ...to here file-5.46/src/compress.c:311:20: branch_false: following 'false' branch (when 'zm != 0')... file-5.46/src/compress.c:315:20: branch_false: ...to here file-5.46/src/compress.c:315:20: branch_true: following 'true' branch (when 'sa_saved == 0')... file-5.46/src/compress.c:318:25: branch_true: ...to here file-5.46/src/compress.c:325:23: call_function: calling 'uncompressbuf' from 'file_zmagic' # 1151| # 1152| (void)fflush(stdout); # 1153|-> (void)fflush(stderr); # 1154| # 1155| for (i = 0; i < __arraycount(fdp); i++) Error: GCC_ANALYZER_WARNING (CWE-401): [#def39] file-5.46/src/compress.c:1172:26: warning[-Wanalyzer-malloc-leak]: leak of 'newbuf' file-5.46/src/compress.c:283:1: enter_function: entry to 'file_zmagic' file-5.46/src/compress.c:297:12: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/compress.c:300:21: branch_true: following 'true' branch... file-5.46/src/compress.c:302:30: branch_true: ...to here file-5.46/src/compress.c:302:20: branch_false: following 'false' branch... file-5.46/src/compress.c:304:20: branch_false: ...to here file-5.46/src/compress.c:304:20: branch_false: following 'false' branch... file-5.46/src/compress.c:307:30: branch_false: ...to here file-5.46/src/compress.c:311:20: branch_false: following 'false' branch (when 'zm != 0')... file-5.46/src/compress.c:315:20: branch_false: ...to here file-5.46/src/compress.c:315:20: branch_true: following 'true' branch (when 'sa_saved == 0')... file-5.46/src/compress.c:318:25: branch_true: ...to here file-5.46/src/compress.c:325:23: call_function: calling 'uncompressbuf' from 'file_zmagic' # 1170| * To avoid this, be sure to create pipes with O_CLOEXEC. # 1171| */ # 1172|-> if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) || # 1173| file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 || # 1174| file_pipe_closexec(fdp[STDERR_FILENO]) == -1) { Error: GCC_ANALYZER_WARNING (CWE-401): [#def40] file-5.46/src/compress.c:1173:13: warning[-Wanalyzer-malloc-leak]: leak of 'newbuf' file-5.46/src/compress.c:283:1: enter_function: entry to 'file_zmagic' file-5.46/src/compress.c:297:12: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/compress.c:300:21: branch_true: following 'true' branch... file-5.46/src/compress.c:302:30: branch_true: ...to here file-5.46/src/compress.c:302:20: branch_false: following 'false' branch... file-5.46/src/compress.c:304:20: branch_false: ...to here file-5.46/src/compress.c:304:20: branch_false: following 'false' branch... file-5.46/src/compress.c:307:30: branch_false: ...to here file-5.46/src/compress.c:311:20: branch_false: following 'false' branch (when 'zm != 0')... file-5.46/src/compress.c:315:20: branch_false: ...to here file-5.46/src/compress.c:315:20: branch_true: following 'true' branch (when 'sa_saved == 0')... file-5.46/src/compress.c:318:25: branch_true: ...to here file-5.46/src/compress.c:325:23: call_function: calling 'uncompressbuf' from 'file_zmagic' # 1171| */ # 1172| if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) || # 1173|-> file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 || # 1174| file_pipe_closexec(fdp[STDERR_FILENO]) == -1) { # 1175| closep(fdp[STDIN_FILENO]); Error: GCC_ANALYZER_WARNING (CWE-401): [#def41] file-5.46/src/compress.c:1174:13: warning[-Wanalyzer-malloc-leak]: leak of 'newbuf' file-5.46/src/compress.c:283:1: enter_function: entry to 'file_zmagic' file-5.46/src/compress.c:297:12: branch_false: following 'false' branch... branch_false: ...to here file-5.46/src/compress.c:300:21: branch_true: following 'true' branch... file-5.46/src/compress.c:302:30: branch_true: ...to here file-5.46/src/compress.c:302:20: branch_false: following 'false' branch... file-5.46/src/compress.c:304:20: branch_false: ...to here file-5.46/src/compress.c:304:20: branch_false: following 'false' branch... file-5.46/src/compress.c:307:30: branch_false: ...to here file-5.46/src/compress.c:311:20: branch_false: following 'false' branch (when 'zm != 0')... file-5.46/src/compress.c:315:20: branch_false: ...to here file-5.46/src/compress.c:315:20: branch_true: following 'true' branch (when 'sa_saved == 0')... file-5.46/src/compress.c:318:25: branch_true: ...to here file-5.46/src/compress.c:325:23: call_function: calling 'uncompressbuf' from 'file_zmagic' # 1172| if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) || # 1173| file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 || # 1174|-> file_pipe_closexec(fdp[STDERR_FILENO]) == -1) { # 1175| closep(fdp[STDIN_FILENO]); # 1176| closep(fdp[STDOUT_FILENO]); Error: GCC_ANALYZER_WARNING (CWE-401): [#def42] file-5.46/src/magic.c:278:29: warning[-Wanalyzer-malloc-leak]: leak of 'buf' file-5.46/src/magic.c:421:1: enter_function: entry to 'file_or_fd' file-5.46/src/magic.c:431:12: branch_false: following 'false' branch... file-5.46/src/magic.c:439:20: branch_false: ...to here file-5.46/src/magic.c:439:20: acquire_memory: allocated here file-5.46/src/magic.c:439:12: branch_false: following 'false' branch (when 'buf' is non-NULL)... file-5.46/src/magic.c:442:17: branch_false: ...to here file-5.46/src/magic.c:457:12: branch_true: following 'true' branch (when 'inname' is non-NULL)... file-5.46/src/magic.c:459:17: branch_true: ...to here file-5.46/src/magic.c:460:20: branch_true: following 'true' branch... file-5.46/src/magic.c:461:34: branch_true: ...to here file-5.46/src/magic.c:474:28: branch_true: following 'true' branch... file-5.46/src/magic.c:475:49: branch_true: ...to here file-5.46/src/magic.c:475:29: call_function: calling 'unreadable_info' from 'file_or_fd' # 276| /* We cannot open it, but we were able to stat it. */ # 277| if (access(file, W_OK) == 0) # 278|-> if (file_printf(ms, "writable, ") == -1) # 279| return -1; # 280| #ifndef WIN32 Error: GCC_ANALYZER_WARNING (CWE-401): [#def43] file-5.46/src/magic.c:282:29: warning[-Wanalyzer-malloc-leak]: leak of 'buf' file-5.46/src/magic.c:421:1: enter_function: entry to 'file_or_fd' file-5.46/src/magic.c:431:12: branch_false: following 'false' branch... file-5.46/src/magic.c:439:20: branch_false: ...to here file-5.46/src/magic.c:439:20: acquire_memory: allocated here file-5.46/src/magic.c:439:12: branch_false: following 'false' branch (when 'buf' is non-NULL)... file-5.46/src/magic.c:442:17: branch_false: ...to here file-5.46/src/magic.c:457:12: branch_true: following 'true' branch (when 'inname' is non-NULL)... file-5.46/src/magic.c:459:17: branch_true: ...to here file-5.46/src/magic.c:460:20: branch_true: following 'true' branch... file-5.46/src/magic.c:461:34: branch_true: ...to here file-5.46/src/magic.c:474:28: branch_true: following 'true' branch... file-5.46/src/magic.c:475:49: branch_true: ...to here file-5.46/src/magic.c:475:29: call_function: calling 'unreadable_info' from 'file_or_fd' # 280| #ifndef WIN32 # 281| if (access(file, X_OK) == 0) # 282|-> if (file_printf(ms, "executable, ") == -1) # 283| return -1; # 284| #else Error: GCC_ANALYZER_WARNING (CWE-401): [#def44] file-5.46/src/magic.c:298:21: warning[-Wanalyzer-malloc-leak]: leak of 'buf' file-5.46/src/magic.c:421:1: enter_function: entry to 'file_or_fd' file-5.46/src/magic.c:431:12: branch_false: following 'false' branch... file-5.46/src/magic.c:439:20: branch_false: ...to here file-5.46/src/magic.c:439:20: acquire_memory: allocated here file-5.46/src/magic.c:439:12: branch_false: following 'false' branch (when 'buf' is non-NULL)... file-5.46/src/magic.c:442:17: branch_false: ...to here file-5.46/src/magic.c:457:12: branch_true: following 'true' branch (when 'inname' is non-NULL)... file-5.46/src/magic.c:459:17: branch_true: ...to here file-5.46/src/magic.c:460:20: branch_true: following 'true' branch... file-5.46/src/magic.c:461:34: branch_true: ...to here file-5.46/src/magic.c:474:28: branch_true: following 'true' branch... file-5.46/src/magic.c:475:49: branch_true: ...to here file-5.46/src/magic.c:475:29: call_function: calling 'unreadable_info' from 'file_or_fd' # 296| } # 297| if (S_ISREG(md)) # 298|-> if (file_printf(ms, "regular file, ") == -1) # 299| return -1; # 300| if (file_printf(ms, "no read permission") == -1) Error: GCC_ANALYZER_WARNING (CWE-401): [#def45] file-5.46/src/magic.c:300:13: warning[-Wanalyzer-malloc-leak]: leak of 'buf' file-5.46/src/magic.c:421:1: enter_function: entry to 'file_or_fd' file-5.46/src/magic.c:431:12: branch_false: following 'false' branch... file-5.46/src/magic.c:439:20: branch_false: ...to here file-5.46/src/magic.c:439:20: acquire_memory: allocated here file-5.46/src/magic.c:439:12: branch_false: following 'false' branch (when 'buf' is non-NULL)... file-5.46/src/magic.c:442:17: branch_false: ...to here file-5.46/src/magic.c:457:12: branch_true: following 'true' branch (when 'inname' is non-NULL)... file-5.46/src/magic.c:459:17: branch_true: ...to here file-5.46/src/magic.c:460:20: branch_true: following 'true' branch... file-5.46/src/magic.c:461:34: branch_true: ...to here file-5.46/src/magic.c:474:28: branch_true: following 'true' branch... file-5.46/src/magic.c:475:49: branch_true: ...to here file-5.46/src/magic.c:475:29: call_function: calling 'unreadable_info' from 'file_or_fd' # 298| if (file_printf(ms, "regular file, ") == -1) # 299| return -1; # 300|-> if (file_printf(ms, "no read permission") == -1) # 301| return -1; # 302| return 0; Error: GCC_ANALYZER_WARNING (CWE-401): [#def46] file-5.46/src/magic.c:442:17: warning[-Wanalyzer-malloc-leak]: leak of 'buf' file-5.46/src/magic.c:431:12: branch_false: following 'false' branch... file-5.46/src/magic.c:439:20: branch_false: ...to here file-5.46/src/magic.c:439:20: acquire_memory: allocated here file-5.46/src/magic.c:439:12: branch_false: following 'false' branch (when 'buf' is non-NULL)... file-5.46/src/magic.c:442:17: branch_false: ...to here file-5.46/src/magic.c:442:17: danger: 'buf' leaks here; was allocated at [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2) # 440| return NULL; # 441| # 442|-> switch (file_fsmagic(ms, inname, &sb)) { # 443| case -1: /* error */ # 444| goto done; Error: GCC_ANALYZER_WARNING (CWE-401): [#def47] file-5.46/src/magic.c:460:27: warning[-Wanalyzer-malloc-leak]: leak of 'buf' file-5.46/src/magic.c:431:12: branch_false: following 'false' branch... file-5.46/src/magic.c:439:20: branch_false: ...to here file-5.46/src/magic.c:439:20: acquire_memory: allocated here file-5.46/src/magic.c:439:12: branch_false: following 'false' branch (when 'buf' is non-NULL)... file-5.46/src/magic.c:442:17: branch_false: ...to here file-5.46/src/magic.c:457:12: branch_true: following 'true' branch (when 'inname' is non-NULL)... file-5.46/src/magic.c:459:17: branch_true: ...to here file-5.46/src/magic.c:460:27: danger: 'buf' leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2) # 458| int flags = O_RDONLY|O_BINARY|O_NONBLOCK|O_CLOEXEC; # 459| errno = 0; # 460|-> if ((fd = open(inname, flags)) < 0) { # 461| okstat = stat(inname, &sb) == 0; # 462| #ifdef WIN32 Error: GCC_ANALYZER_WARNING (CWE-401): [#def48] file-5.46/src/magic.c:500:37: warning[-Wanalyzer-malloc-leak]: leak of 'buf' file-5.46/src/magic.c:431:12: branch_false: following 'false' branch... file-5.46/src/magic.c:439:20: branch_false: ...to here file-5.46/src/magic.c:439:20: acquire_memory: allocated here file-5.46/src/magic.c:439:12: branch_false: following 'false' branch (when 'buf' is non-NULL)... file-5.46/src/magic.c:442:17: branch_false: ...to here file-5.46/src/magic.c:460:20: branch_false: following 'false' branch... file-5.46/src/magic.c:486:26: branch_false: ...to here file-5.46/src/magic.c:496:12: branch_true: following 'true' branch (when 'ispipe != 0')... branch_true: ...to here file-5.46/src/magic.c:500:37: danger: 'buf' leaks here; was allocated at [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2) # 498| ssize_t r = 0; # 499| # 500|-> while ((r = sread(fd, RCAST(void *, &buf[nbytes]), # 501| CAST(size_t, ms->bytes_max - nbytes), 1)) > 0) { # 502| nbytes += r; Error: GCC_ANALYZER_WARNING (CWE-401): [#def49] file-5.46/src/magic.c:524:33: warning[-Wanalyzer-malloc-leak]: leak of 'buf' file-5.46/src/magic.c:431:12: branch_false: following 'false' branch... file-5.46/src/magic.c:439:20: branch_false: ...to here file-5.46/src/magic.c:439:20: acquire_memory: allocated here file-5.46/src/magic.c:439:12: branch_false: following 'false' branch (when 'buf' is non-NULL)... file-5.46/src/magic.c:442:17: branch_false: ...to here file-5.46/src/magic.c:485:12: branch_true: following 'true' branch (when 'fd != -1')... file-5.46/src/magic.c:486:26: branch_true: ...to here file-5.46/src/magic.c:496:12: branch_false: following 'false' branch (when 'ispipe == 0')... file-5.46/src/magic.c:515:19: branch_false: ...to here file-5.46/src/magic.c:515:19: branch_true: following 'true' branch (when 'fd != -1')... file-5.46/src/magic.c:517:24: branch_true: ...to here file-5.46/src/magic.c:522:20: branch_true: following 'true' branch... file-5.46/src/magic.c:523:29: branch_true: ...to here file-5.46/src/magic.c:523:28: branch_true: following 'true' branch... file-5.46/src/magic.c:524:48: branch_true: ...to here file-5.46/src/magic.c:524:33: danger: 'buf' leaks here; was allocated at [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2) # 522| if ((nbytes = read(fd, RCAST(void *, buf), howmany)) == -1) { # 523| if (inname == NULL && fd != STDIN_FILENO) # 524|-> file_error(ms, errno, "cannot read fd %d", fd); # 525| else # 526| file_error(ms, errno, "cannot read `%s'", Error: GCC_ANALYZER_WARNING (CWE-401): [#def50] file-5.46/src/magic.c:526:33: warning[-Wanalyzer-malloc-leak]: leak of 'buf' file-5.46/src/magic.c:431:12: branch_false: following 'false' branch... file-5.46/src/magic.c:439:20: branch_false: ...to here file-5.46/src/magic.c:439:20: acquire_memory: allocated here file-5.46/src/magic.c:439:12: branch_false: following 'false' branch (when 'buf' is non-NULL)... file-5.46/src/magic.c:442:17: branch_false: ...to here file-5.46/src/magic.c:485:12: branch_true: following 'true' branch (when 'fd != -1')... file-5.46/src/magic.c:486:26: branch_true: ...to here file-5.46/src/magic.c:496:12: branch_false: following 'false' branch (when 'ispipe == 0')... file-5.46/src/magic.c:515:19: branch_false: ...to here file-5.46/src/magic.c:515:19: branch_true: following 'true' branch (when 'fd != -1')... file-5.46/src/magic.c:517:24: branch_true: ...to here file-5.46/src/magic.c:522:20: branch_true: following 'true' branch... file-5.46/src/magic.c:523:29: branch_true: ...to here file-5.46/src/magic.c:523:28: branch_false: following 'false' branch... file-5.46/src/magic.c:526:33: branch_false: ...to here file-5.46/src/magic.c:526:33: danger: 'buf' leaks here; was allocated at [(3)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/2) # 524| file_error(ms, errno, "cannot read fd %d", fd); # 525| else # 526|-> file_error(ms, errno, "cannot read `%s'", # 527| inname == NULL ? "/dev/stdin" : inname); # 528| goto done; Error: GCC_ANALYZER_WARNING (CWE-401): [#def51] file-5.46/src/magic.c:533:13: warning[-Wanalyzer-malloc-leak]: leak of 'buf' file-5.46/src/magic.c:431:12: branch_false: following 'false' branch... file-5.46/src/magic.c:439:20: branch_false: ...to here file-5.46/src/magic.c:439:20: acquire_memory: allocated here file-5.46/src/magic.c:439:12: branch_false: following 'false' branch (when 'buf' is non-NULL)... file-5.46/src/magic.c:442:17: branch_false: ...to here file-5.46/src/magic.c:457:12: branch_false: following 'false' branch (when 'inname' is NULL)... file-5.46/src/magic.c:485:12: branch_false: ...to here file-5.46/src/magic.c:485:12: branch_false: following 'false' branch (when 'fd == -1')... file-5.46/src/magic.c:515:19: branch_false: ...to here file-5.46/src/magic.c:515:19: branch_false: following 'false' branch (when 'fd == -1')... file-5.46/src/magic.c:532:15: branch_false: ...to here file-5.46/src/magic.c:533:13: branch_false: following 'false' branch (when 'okstat == 0')... branch_false: ...to here file-5.46/src/magic.c:533:13: danger: 'buf' leaks here; was allocated at [(3)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/2) # 531| # 532| (void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */ # 533|-> if (file_buffer(ms, fd, okstat ? &sb : NULL, inname, buf, CAST(size_t, nbytes)) == -1) # 534| goto done; # 535| rv = 0; Error: GCC_ANALYZER_WARNING (CWE-404): [#def52] file-5.46/src/print.c:249:16: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end' file-5.46/src/print.c:258:1: enter_function: entry to 'file_magwarn1' file-5.46/src/print.c:262:9: acquire_resource: 'va_start' called here file-5.46/src/print.c:263:9: call_function: calling 'file_vmagwarn' from 'file_magwarn1' # 247| { # 248| /* cuz we use stdout for most, stderr here */ # 249|-> (void) fflush(stdout); # 250| # 251| (void) fprintf(stderr, "Warning: "); Error: CPPCHECK_WARNING (CWE-758): [#def53] file-5.46/src/softmagic.c:1220: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1218| } # 1219| case FILE_BESHORT: # 1220|-> p->h = CAST(short, BE16(p->hs)); # 1221| if (cvt_16(p, m) == -1) # 1222| goto out; Error: CPPCHECK_WARNING (CWE-758): [#def54] file-5.46/src/softmagic.c:1227: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1225| case FILE_BEDATE: # 1226| case FILE_BELDATE: # 1227|-> p->l = CAST(int32_t, BE32(p->hl)); # 1228| if (cvt_32(p, m) == -1) # 1229| goto out; Error: CPPCHECK_WARNING (CWE-758): [#def55] file-5.46/src/softmagic.c:1235: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1233| case FILE_BEQLDATE: # 1234| case FILE_BEQWDATE: # 1235|-> p->q = CAST(uint64_t, BE64(p->hq)); # 1236| if (cvt_64(p, m) == -1) # 1237| goto out; Error: CPPCHECK_WARNING (CWE-758): [#def56] file-5.46/src/softmagic.c:1240: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1238| return 1; # 1239| case FILE_LESHORT: # 1240|-> p->h = CAST(short, LE16(p->hs)); # 1241| if (cvt_16(p, m) == -1) # 1242| goto out; Error: CPPCHECK_WARNING (CWE-758): [#def57] file-5.46/src/softmagic.c:1247: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1245| case FILE_LEDATE: # 1246| case FILE_LELDATE: # 1247|-> p->l = CAST(int32_t, LE32(p->hl)); # 1248| if (cvt_32(p, m) == -1) # 1249| goto out; Error: CPPCHECK_WARNING (CWE-758): [#def58] file-5.46/src/softmagic.c:1255: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1253| case FILE_LEQLDATE: # 1254| case FILE_LEQWDATE: # 1255|-> p->q = CAST(uint64_t, LE64(p->hq)); # 1256| if (cvt_64(p, m) == -1) # 1257| goto out; Error: CPPCHECK_WARNING (CWE-758): [#def59] file-5.46/src/softmagic.c:1262: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1260| case FILE_MEDATE: # 1261| case FILE_MELDATE: # 1262|-> p->l = CAST(int32_t, ME32(p->hl)); # 1263| if (cvt_32(p, m) == -1) # 1264| goto out; Error: CPPCHECK_WARNING (CWE-758): [#def60] file-5.46/src/softmagic.c:1271: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1269| return 1; # 1270| case FILE_BEFLOAT: # 1271|-> p->l = BE32(p->hl); # 1272| if (cvt_float(p, m) == -1) # 1273| goto out; Error: CPPCHECK_WARNING (CWE-758): [#def61] file-5.46/src/softmagic.c:1276: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1274| return 1; # 1275| case FILE_LEFLOAT: # 1276|-> p->l = LE32(p->hl); # 1277| if (cvt_float(p, m) == -1) # 1278| goto out; Error: CPPCHECK_WARNING (CWE-758): [#def62] file-5.46/src/softmagic.c:1285: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1283| return 1; # 1284| case FILE_BEDOUBLE: # 1285|-> p->q = BE64(p->hq); # 1286| if (cvt_double(p, m) == -1) # 1287| goto out; Error: CPPCHECK_WARNING (CWE-758): [#def63] file-5.46/src/softmagic.c:1290: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1288| return 1; # 1289| case FILE_LEDOUBLE: # 1290|-> p->q = LE64(p->hq); # 1291| if (cvt_double(p, m) == -1) # 1292| goto out; Error: GCC_ANALYZER_WARNING (CWE-401): [#def64] file-5.46/src/softmagic.c:2090:14: warning[-Wanalyzer-malloc-leak]: leak of 'rx' file-5.46/src/softmagic.c:2082:28: acquire_memory: allocated here file-5.46/src/softmagic.c:2084:12: branch_false: following 'false' branch (when 'rx' is non-NULL)... file-5.46/src/softmagic.c:2091:15: branch_false: ...to here file-5.46/src/softmagic.c:2090:14: danger: 'rx' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) # 2088| } # 2089| # 2090|-> rc = file_regcomp(ms, rx, m->value.s, REG_EXTENDED | REG_NEWLINE | # 2091| ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0)); # 2092| if (rc == 0) Error: GCC_ANALYZER_WARNING (CWE-401): [#def65] file-5.46/src/softmagic.c:2338:22: warning[-Wanalyzer-malloc-leak]: leak of 'copy' file-5.46/src/softmagic.c:2314:20: branch_false: following 'false' branch... file-5.46/src/softmagic.c:2317:20: branch_false: ...to here file-5.46/src/softmagic.c:2323:20: branch_true: following 'true' branch (when 'slen != 0')... file-5.46/src/softmagic.c:2324:28: branch_true: ...to here file-5.46/src/softmagic.c:2324:28: acquire_memory: allocated here file-5.46/src/softmagic.c:2325:24: branch_false: following 'false' branch (when 'copy' is non-NULL)... file-5.46/src/softmagic.c:2331:34: branch_false: ...to here file-5.46/src/softmagic.c:2338:22: danger: 'copy' leaks here; was allocated at [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6) # 2336| copy = NULL; # 2337| } # 2338|-> rc = file_regexec(ms, rx, RCAST(const char *, search), # 2339| 1, &pmatch, 0); # 2340| free(copy);
| analyzer-version-clippy | 1.90.0 |
| analyzer-version-cppcheck | 2.18.3 |
| analyzer-version-gcc | 15.2.1 |
| analyzer-version-gcc-analyzer | 16.0.0 |
| analyzer-version-shellcheck | 0.11.0 |
| analyzer-version-unicontrol | 0.0.2 |
| enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol |
| exit-code | 0 |
| host | ip-172-16-1-64.us-west-2.compute.internal |
| known-false-positives | /usr/share/csmock/known-false-positives.js |
| known-false-positives-rpm | known-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch |
| mock-config | fedora-rawhide-gcc-latest-x86_64 |
| project-name | file-5.46-8.fc44 |
| store-results-to | /tmp/tmpjirysfmv/file-5.46-8.fc44.tar.xz |
| time-created | 2025-10-28 17:52:49 |
| time-finished | 2025-10-28 17:54:46 |
| tool | csmock |
| tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmpjirysfmv/file-5.46-8.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpjirysfmv/file-5.46-8.fc44.src.rpm' |
| tool-version | csmock-3.8.3.20251027.143044.ge6b947b-1.el9 |