Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
libudfread-1.1.2/examples/udfls.c:34:12: warning[-Wanalyzer-malloc-leak]: leak of ‘next_dir’
libudfread-1.1.2/examples/udfls.c:76:5: enter_function: entry to ‘main’
libudfread-1.1.2/examples/udfls.c:81:8: branch_false: following ‘false’ branch (when ‘argc > 1’)...
libudfread-1.1.2/examples/udfls.c:87:11: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:88:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:92:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:92:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:98:5: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:101:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:104:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:104:9: call_function: calling ‘_lsdir_at’ from ‘main’
#   32|       struct udfread_dirent dirent;
#   33|   
#   34|->     while (udfread_readdir(dir, &dirent)) {
#   35|           if (!strcmp(dirent.d_name, ".") || !strcmp(dirent.d_name, "..")) continue;
#   36|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
libudfread-1.1.2/examples/udfls.c:43:31: warning[-Wanalyzer-malloc-leak]: leak of ‘next_dir’
libudfread-1.1.2/examples/udfls.c:76:5: enter_function: entry to ‘main’
libudfread-1.1.2/examples/udfls.c:81:8: branch_false: following ‘false’ branch (when ‘argc > 1’)...
libudfread-1.1.2/examples/udfls.c:87:11: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:88:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:92:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:92:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:98:5: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:101:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:104:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:104:9: call_function: calling ‘_lsdir_at’ from ‘main’
#   41|               printf("\t\t %s%s\n", path, dirent.d_name);
#   42|   
#   43|->             next_dir = (char*)malloc(strlen(path) + strlen(dirent.d_name) + 2);
#   44|               if (!next_dir) {
#   45|                   fprintf(stderr, "out of memory\n");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
libudfread-1.1.2/examples/udfls.c:50:21: warning[-Wanalyzer-malloc-leak]: leak of ‘next_dir’
libudfread-1.1.2/examples/udfls.c:76:5: enter_function: entry to ‘main’
libudfread-1.1.2/examples/udfls.c:81:8: branch_false: following ‘false’ branch (when ‘argc > 1’)...
libudfread-1.1.2/examples/udfls.c:87:11: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:88:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:92:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:92:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:98:5: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:101:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:104:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:104:9: call_function: calling ‘_lsdir_at’ from ‘main’
#   48|               sprintf(next_dir, "%s%s/",  path, dirent.d_name);
#   49|   
#   50|->             child = udfread_opendir_at(dir, dirent.d_name);
#   51|               if (!child) {
#   52|                   fprintf(stderr, "error opening directory %s\n", dirent.d_name);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
libudfread-1.1.2/examples/udfls.c:63:18: warning[-Wanalyzer-malloc-leak]: leak of ‘next_dir’
libudfread-1.1.2/examples/udfls.c:76:5: enter_function: entry to ‘main’
libudfread-1.1.2/examples/udfls.c:81:8: branch_false: following ‘false’ branch (when ‘argc > 1’)...
libudfread-1.1.2/examples/udfls.c:87:11: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:88:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:92:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:92:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:98:5: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:101:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:104:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:104:9: call_function: calling ‘_lsdir_at’ from ‘main’
#   61|               UDFFILE *fp;
#   62|   
#   63|->             fp = udfread_file_openat(dir, dirent.d_name);
#   64|               if (!fp) {
#   65|                   fprintf(stderr, "error opening file '%s%s'\n", path, dirent.d_name);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
libudfread-1.1.2/examples/udfls.c:68:13: warning[-Wanalyzer-malloc-leak]: leak of ‘next_dir’
libudfread-1.1.2/examples/udfls.c:76:5: enter_function: entry to ‘main’
libudfread-1.1.2/examples/udfls.c:81:8: branch_false: following ‘false’ branch (when ‘argc > 1’)...
libudfread-1.1.2/examples/udfls.c:87:11: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:88:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:92:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:92:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:98:5: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:101:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:104:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:104:9: call_function: calling ‘_lsdir_at’ from ‘main’
#   66|                   continue;
#   67|               }
#   68|->             printf("%16" PRId64 " %s%s\n",  udfread_file_size(fp), path, dirent.d_name);
#   69|               udfread_file_close(fp);
#   70|           }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
libudfread-1.1.2/examples/udfls.c:69:13: warning[-Wanalyzer-malloc-leak]: leak of ‘next_dir’
libudfread-1.1.2/examples/udfls.c:76:5: enter_function: entry to ‘main’
libudfread-1.1.2/examples/udfls.c:81:8: branch_false: following ‘false’ branch (when ‘argc > 1’)...
libudfread-1.1.2/examples/udfls.c:87:11: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:88:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:92:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:92:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:98:5: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:101:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:104:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:104:9: call_function: calling ‘_lsdir_at’ from ‘main’
#   67|               }
#   68|               printf("%16" PRId64 " %s%s\n",  udfread_file_size(fp), path, dirent.d_name);
#   69|->             udfread_file_close(fp);
#   70|           }
#   71|       }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
libudfread-1.1.2/examples/udfls.c:73:12: warning[-Wanalyzer-malloc-leak]: leak of ‘next_dir’
libudfread-1.1.2/examples/udfls.c:76:5: enter_function: entry to ‘main’
libudfread-1.1.2/examples/udfls.c:81:8: branch_false: following ‘false’ branch (when ‘argc > 1’)...
libudfread-1.1.2/examples/udfls.c:87:11: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:88:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:92:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:92:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:98:5: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:101:8: branch_false: following ‘false’ branch...
libudfread-1.1.2/examples/udfls.c:104:9: branch_false: ...to here
libudfread-1.1.2/examples/udfls.c:104:9: call_function: calling ‘_lsdir_at’ from ‘main’
#   71|       }
#   72|   
#   73|->     return 0;
#   74|   }
#   75|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
libudfread-1.1.2/src/default_blockinput.c:201:13: warning[-Wanalyzer-malloc-leak]: leak of 'p'
libudfread-1.1.2/src/default_blockinput.c:193:52: acquire_memory: allocated here
libudfread-1.1.2/src/default_blockinput.c:194:8: branch_false: following 'false' branch (when 'p' is non-NULL)...
libudfread-1.1.2/src/default_blockinput.c:201:13: branch_false: ...to here
libudfread-1.1.2/src/default_blockinput.c:201:13: throw: if 'open' throws an exception...
libudfread-1.1.2/src/default_blockinput.c:201:13: danger: 'p' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  199|       p->fd = _open_win32(path, O_RDONLY | O_BINARY);
#  200|   #else
#  201|->     p->fd = open(path, O_RDONLY);
#  202|   #endif
#  203|       if(p->fd < 0) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
libudfread-1.1.2/src/default_blockinput.c:212:12: warning[-Wanalyzer-malloc-leak]: leak of 'p'
libudfread-1.1.2/src/default_blockinput.c:193:52: acquire_memory: allocated here
libudfread-1.1.2/src/default_blockinput.c:194:8: branch_false: following 'false' branch (when 'p' is non-NULL)...
libudfread-1.1.2/src/default_blockinput.c:201:13: branch_false: ...to here
libudfread-1.1.2/src/default_blockinput.c:203:7: branch_false: following 'false' branch...
libudfread-1.1.2/src/default_blockinput.c:208:5: branch_false: ...to here
libudfread-1.1.2/src/default_blockinput.c:212:12: danger: 'p' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  210|       p->input.size  = _def_size;
#  211|   
#  212|->     return &p->input;
#  213|   }

Error: GCC_ANALYZER_WARNING (CWE-465): [#def10]
libudfread-1.1.2/src/ecma167.c:366:8: warning[-Wanalyzer-deref-before-check]: check of 'fe' for NULL after already dereferencing it
libudfread-1.1.2/src/ecma167.c:347:8: branch_false: following 'false' branch...
libudfread-1.1.2/src/ecma167.c:360:8: branch_false: following 'false' branch (when 'num_ad != 0')...
libudfread-1.1.2/src/ecma167.c:365:100: branch_false: ...to here
libudfread-1.1.2/src/ecma167.c:366:8: danger: pointer 'fe' is checked for NULL here but it was already dereferenced at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  364|   
#  365|       fe = (struct file_entry *)realloc(*p_fe, sizeof(struct file_entry) + sizeof(struct long_ad) * (fe->u.ads.num_ad + num_ad));
#  366|->     if (!fe) {
#  367|           return -1;
#  368|       }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
libudfread-1.1.2/src/udfread.c:257:14: warning[-Wanalyzer-malloc-leak]: leak of 'buf'
libudfread-1.1.2/src/udfread.c:1434:17: enter_function: entry to '_file_open'
libudfread-1.1.2/src/udfread.c:1439:8: branch_false: following 'false' branch...
libudfread-1.1.2/src/udfread.c:1444:10: branch_false: ...to here
libudfread-1.1.2/src/udfread.c:1444:10: call_function: calling '_read_file_entry' from '_file_open'
#  255|       }
#  256|   
#  257|->     result = input->read(input, lba, buf, nblocks, flags);
#  258|   
#  259|       return result < 0 ? 0 : (uint32_t)result;

Error: COMPILER_WARNING: [#def12]
libudfread-1.1.2/src/udfread.c: scope_hint: In function '_read_subdir'
libudfread-1.1.2/src/udfread.c:1099:69: warning[-Wcalloc-transposed-args]: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument
# 1099 |         struct udf_dir **subdirs = (struct udf_dir **)calloc(sizeof(struct udf_dir *), dir->num_entries);
#      |                                                                     ^~~~~~
libudfread-1.1.2/src/udfread.c:1099:69: note: earlier argument should specify number of elements, later size of each element
# 1097|   
# 1098|       if (!dir->subdirs) {
# 1099|->         struct udf_dir **subdirs = (struct udf_dir **)calloc(sizeof(struct udf_dir *), dir->num_entries);
# 1100|           if (!subdirs) {
# 1101|               udf_error("out of memory\n");

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-197.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-namelibudfread-1.2.0-2.fc44
diffbase-store-results-to/tmp/tmpjr4fkbku/libudfread-1.2.0-2.fc44.tar.xz
diffbase-time-created2026-01-08 19:20:29
diffbase-time-finished2026-01-08 19:21:41
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpjr4fkbku/libudfread-1.2.0-2.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpjr4fkbku/libudfread-1.2.0-2.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-197.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-namelibudfread-1.1.2-12.fc43
store-results-to/tmp/tmpbzc4stxm/libudfread-1.1.2-12.fc43.tar.xz
time-created2026-01-08 19:18:26
time-finished2026-01-08 19:20:11
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpbzc4stxm/libudfread-1.1.2-12.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpbzc4stxm/libudfread-1.1.2-12.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9