Task #2030 - fixed.err
back to task #2030download
Error: COMPILER_WARNING: ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast_std.h:34: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:32: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/src/cmd/ksh93/874c48750.c:2: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast_standards.h:12:9: warning: "basename" redefined ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast_common.h:152: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/bytesex.h:27: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/endian.h:27: included_from: Included from here. /usr/include/sys/types.h:176: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/src/cmd/ksh93/874c48750.c:1: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast_map.h:12:9: note: this is the location of the previous definition # 10| #define _FILE_OFFSET_BITS 64 # 11| #endif # 12|-> #define basename basename /* avoid string.h defining this in conflict with AST basename(3) */ # 13| # 14| #endif Error: COMPILER_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:47: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:31: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c: scope_hint: In function 'sh_reinit' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/cdt.h:265:26: warning[-Wsequence-point]: operation on 'sh.fun_base' may be undefined # 265 | #define _DT(dt) ((Dt_t*)(dt)) # | ~^~~~~~~~~~~~ ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/cdt.h:305:28: note: in expansion of macro '_DT' # 305 | #define dtclear(d) (*(_DT(d)->searchf))((d),(void*)(0),DT_CLEAR) # | ^~~ ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1609:9: note: in expansion of macro 'dtclear' # 1609 | dtclear(sh.fun_base = sh.fun_tree); # | ^~~~~~~ # 263| # 264| /* internal functions for translating among holder, object and key */ # 265|-> #define _DT(dt) ((Dt_t*)(dt)) # 266| # 267| #define _DTLNK(dc,o) ((Dtlink_t*)((char*)(o) + (dc)->link) ) /* get link from obj */ Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:47: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c: scope_hint: In function 'sh_inittree' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/cdt.h:298:26: warning[-Wanalyzer-null-dereference]: dereference of NULL 'treep' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1988:17: note: in expansion of macro 'dtinsert' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1822:22: note: in expansion of macro 'sh_newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1822:22: note: in expansion of macro 'sh_newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/name.h:56: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:49: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1984:20: note: in expansion of macro 'nv_isattr' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1984:20: note: in expansion of macro 'nv_isattr' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1988:17: note: in expansion of macro 'dtinsert' # 296| #define dtsearch(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_SEARCH) # 297| #define dtmatch(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_MATCH) # 298|-> #define dtinsert(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_INSERT) # 299| #define dtinstall(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_INSTALL) # 300| #define dtappend(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_APPEND) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:36: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:36: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:24: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c: scope_hint: In function 'sh_outtype' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:305:33: warning[-Wanalyzer-null-dereference]: dereference of NULL 'iop' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:356:51: note: in expansion of macro '__sf_putc' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:1486:41: note: in expansion of macro 'sfputc' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:26: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:1428:22: note: in expansion of macro 'L_ARGNOD' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:47: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:1433:29: note: in expansion of macro 'dtfirst' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/name.h:56: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:49: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/name.h:170:26: note: in expansion of macro 'nv_isattr' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/name.h:171:27: note: in expansion of macro 'nv_isnonptr' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:1444:20: note: in expansion of macro 'nv_isnull' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:1448:28: note: in expansion of macro 'L_ARGNOD' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:1470:28: note: in expansion of macro 'nv_isattr' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:1477:36: note: in expansion of macro 'nv_isattr' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:356:51: note: in expansion of macro '__sf_putc' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:1486:41: note: in expansion of macro 'sfputc' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:356:51: note: in expansion of macro '__sf_putc' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:1486:41: note: in expansion of macro 'sfputc' # 303| #define __sf_putm(f,v,m) (_sfputm(_SF_(f),(Sfulong_t)(v),(Sfulong_t)(m))) # 304| # 305|-> #define __sf_putc(f,c) (_SF_(f)->_next >= _SF_(f)->_endw ? \ # 306| _sfflsbuf(_SF_(f),(int)((unsigned char)(c))) : \ # 307| (int)(*_SF_(f)->_next++ = (unsigned char)(c)) ) Error: COMPILER_WARNING (CWE-681): ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/src/lib/libast/conf.tmp.c:14:1: warning[-Woverflow]: unsigned conversion from 'long int' to 'unsigned int' changes value from '9223372036854775807' to '4294967295' Error: GCC_ANALYZER_WARNING (CWE-775): ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/src/lib/libast/conf.tmp.c: scope_hint: In function 'main' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/src/lib/libast/conf.tmp.c:22:75: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open("/proc/sys/kernel/pid_max", 0)' Error: GCC_ANALYZER_WARNING (CWE-775): ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/src/lib/libast/conf.tmp.c: scope_hint: In function 'main' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/src/lib/libast/conf.tmp.c:23:75: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open("/proc/sys/kernel/pid_max", 0)' Error: COMPILER_WARNING (CWE-681): ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/src/lib/libast/conf.tmp.c:73:1: warning[-Woverflow]: unsigned conversion from 'long int' to 'unsigned int' changes value from '9223372036854775807' to '4294967295' Error: COMPILER_WARNING (CWE-697): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/strptime.c:27: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/strptime.c: scope_hint: In function 'strptime' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/src/lib/libast/tmx.h:34:36: warning[-Waddress]: the address of 't' will always evaluate as 'true' # 34 | #define tmxclock(p) tmxsns(((p)?*(p):time(NULL)),0) # | ^ ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/src/lib/libast/tmx.h:25:38: note: in definition of macro 'tmxsns' # 25 | #define tmxsns(s,n) (((((Time_t)(s))*1000000000))+((Time_t)(n))) # | ^ ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/strptime.c:62:20: note: in expansion of macro 'tmxclock' # 62 | tmxtm(&tm, tmxclock(&t), NULL, 0); # | ^~~~~~~~ # 32| #define tv2tmx(v) tmxsns((v)->tv_sec,(v)->tv_nsec) # 33| # 34|-> #define tmxclock(p) tmxsns(((p)?*(p):time(NULL)),0) # 35| # 36| #define tmxgetatime(s) tmxsns((s)->st_atime,ST_ATIME_NSEC_GET(s)) Error: GCC_ANALYZER_WARNING (CWE-688): ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/intl.c: scope_hint: In function 'main' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/intl.c:25:9: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/intl.c:19: included_from: Included from here. /usr/include/libintl.h:39:14: note: argument 1 of 'gettext' must be non-null # 23| main(void) # 24| { # 25|-> gettext(0); # 26| return 0; # 27| } Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c: scope_hint: In function 'run.part.0' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:158:85: warning[-Wanalyzer-null-dereference]: dereference of NULL '*<unknown>.nxt' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:1306:33: note: in expansion of macro 'add' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:435:26: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:435:65: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:435:65: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:1306:33: note: in expansion of macro 'add' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:1306:33: note: in expansion of macro 'add' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:1306:33: note: in expansion of macro 'add' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:1306:33: note: in expansion of macro 'add' # 156| #define delimiter(c) ((c)==' '||(c)=='\t'||(c)=='\n'||(c)==';'||(c)=='('||(c)==')'||(c)=='`'||(c)=='|'||(c)=='&'||(c)=='=') # 157| # 158|-> #define add(b,c) (((b)->nxt >= (b)->end) ? append(b, "") : NULL, *(b)->nxt++ = (c)) # 159| #define get(b) ((b)->nxt-(b)->buf) # 160| #define set(b,o) ((b)->nxt=(b)->buf+(o)) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c: scope_hint: In function 'buffer' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:437:23: warning[-Wanalyzer-null-dereference]: dereference of NULL 'buf' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:435:26: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:435:26: note: in expansion of macro 'newof' # 435| else if (!(buf = newof(0, Buf_t, 1, 0)) || !(buf->buf = newof(0, char, CHUNK, 0))) # 436| report(3, "out of memory [buffer]", NULL, 0); # 437|-> buf->end = buf->buf + CHUNK; # 438| buf->nxt = buf->buf; # 439| return buf; Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c: scope_hint: In function 'appendn' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:467:20: warning[-Wanalyzer-malloc-leak]: leak of '*buf.buf' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:467:34: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:467:34: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:467:34: note: in expansion of macro 'newof' # 465| i = buf->nxt - buf->buf; # 466| m = (((buf->end - buf->buf) + n + CHUNK + 1) / CHUNK) * CHUNK; # 467|-> if (!(buf->buf = newof(buf->buf, char, m, 0))) # 468| report(3, "out of memory [buffer resize]", NULL, 0); # 469| buf->end = buf->buf + m; Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:470:26: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:435:26: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:435:65: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:435:65: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:467:34: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:467:34: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:467:34: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c: scope_hint: In function 'appendn' # 468| report(3, "out of memory [buffer resize]", NULL, 0); # 469| buf->end = buf->buf + m; # 470|-> buf->nxt = buf->buf + i; # 471| } # 472| memcpy(buf->nxt, str, n + 1); Error: GCC_ANALYZER_WARNING (CWE-688): ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:472:9: warning[-Wanalyzer-null-argument]: use of NULL '*buf.nxt' where non-null expected ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:435:26: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:435:65: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:435:65: note: in expansion of macro 'newof' <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 470| buf->nxt = buf->buf + i; # 471| } # 472|-> memcpy(buf->nxt, str, n + 1); # 473| buf->nxt += n; # 474| return buf->buf; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:593:3: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 591| if (!(root = newof(0, Dict_item_t, 1, strlen(name)))) # 592| report(3, "out of memory [dictionary]", name, 0); # 593|-> strcpy(root->name, name); # 594| } # 595| if (root) Error: COMPILER_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c: scope_hint: In function 'search' ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:593:17: warning[-Wstringop-overflow=]: 'strcpy' writing 1 or more bytes into a region of size 0 overflows the destination cc1: note: destination object is likely at address zero # 591| if (!(root = newof(0, Dict_item_t, 1, strlen(name)))) # 592| report(3, "out of memory [dictionary]", name, 0); # 593|-> strcpy(root->name, name); # 594| } # 595| if (root) Error: CPPCHECK_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:773: warning[uninitvar]: Uninitialized variable: p # 771| } # 772| n = strlen(s); # 773|-> if (!(vp = newof(0, View_t, 1, strlen(p) + n + 1))) # 774| report(3, "out of memory [view]", s, 0); # 775| vp->node = n + 1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:773:35: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 771| } # 772| n = strlen(s); # 773|-> if (!(vp = newof(0, View_t, 1, strlen(p) + n + 1))) # 774| report(3, "out of memory [view]", s, 0); # 775| vp->node = n + 1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:783:19: warning[core.NullDereference]: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'zp') # 781| state.view = zp = vp; # 782| else # 783|-> zp = zp->next = vp; # 784| if (!c) # 785| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:1114:7: warning[core.NullDereference]: Access to field 'fp' results in a dereference of a null pointer (loaded from field 'sp') # 1112| if (!state.sp) # 1113| report(3, "input stack underflow", NULL, 0); # 1114|-> if (!state.sp->fp || (state.sp->flags & STREAM_KEEP)) # 1115| r = 0; # 1116| else if (state.sp->flags & STREAM_PIPE) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:1407:15: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'p') # 1405| do # 1406| { # 1407|-> for (d = p; *p && *p != ':'; p++); # 1408| c = *p; # 1409| *p = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:1458:14: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 's') # 1456| pro = buffer(); # 1457| s = cc = path(pro, cc, 1); # 1458|-> for (h = 0; *s; s++) # 1459| h = h * 0x63c63cd9L + *s + 0x9c39c33dL; # 1460| if (!(s = (char*)search(state.vars, "INSTALLROOT", NULL))) Error: CPPCHECK_WARNING (CWE-768): ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:1476: error[unknownEvaluationOrder]: Expression '*(tmp)->nxt=0,tmp->nxt=(tmp)->buf' depends on order of evaluation of side effects # 1474| add(tmp, ' '); # 1475| append(tmp, cc); # 1476|-> if (execute(use(tmp))) # 1477| report(3, "cannot generate probe info", s, 0); # 1478| drop(tmp); Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:1611: error[nullPointer]: Null pointer dereference # 1609| append(tmp, lib + 2); # 1610| append(tmp, ".req"); # 1611|-> if (!(f = fopen(use(tmp), "r"))) # 1612| { # 1613| append(tmp, "${INSTALLROOT}/lib/lib/"); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/INIT/mamake.c:1658:7: warning[unix.Malloc]: Use of memory after it is freed # 1656| } # 1657| } # 1658|-> r = duplicate(r); # 1659| search(state.vars, lib, r); # 1660| append(tmp, "mam_lib"); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/builtin/pty.c:902:10: warning[deadcode.DeadStores]: Although the value stored to 'm' is used in the enclosing expression, the value is never actually read from 'm' # 900| if (cond->flags & SKIP) # 901| continue; # 902|-> if (!(m = masterline(mp, lp, s, 1, timeout, master))) # 903| goto done; # 904| break; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/cd_pwd.c: scope_hint: In function 'b_cd' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/cd_pwd.c:151:22: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/error.h:31: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:45: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/cd_pwd.c:30: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/cd_pwd.c:89:17: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:36: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:36: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/cd_pwd.c:149:22: note: in expansion of macro 'sfstruse' # 149| cp = sfstruse(sh.strbuf); # 150| pathcanon(cp, 0); # 151|-> if(cp[0]=='.' && cp[1]=='.' && (cp[2]=='/' || cp[2]==0)) # 152| { # 153| if(!sh.strbuf2) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/misc.c:328:3: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value # 326| update_sh_level(); # 327| if((np || argv[1]) && jmpval!=SH_JMPSCRIPT) # 328|-> sh_argreset((struct dolnod*)argsave,saveargfor); # 329| else # 330| { Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/misc.c: scope_hint: In function 'b_dot_cmd' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/misc.c:328:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'saveargfor' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/shell.h:34: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:69: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/misc.c:40: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/stk.h:41:35: note: in definition of macro 'stkptr' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/shell.h:40: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/misc.c:302:9: note: in expansion of macro 'sh_pushcontext' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/fault.h:27: included_from: Included from here. # 326| update_sh_level(); # 327| if((np || argv[1]) && jmpval!=SH_JMPSCRIPT) # 328|-> sh_argreset((struct dolnod*)argsave,saveargfor); # 329| else # 330| { Error: COMPILER_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/print.c: scope_hint: In function 'b_print' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/print.c:181:23: warning[-Wdangling-pointer=]: storing the address of local variable 'disc' in '_opt_infop_.1_1->disc' # 181 | opt_info.disc = &disc; ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/print.c:177:19: note: 'disc' declared here # 177 | Optdisc_t disc; # | ^~~~ ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/error.h:31: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:45: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/print.c:29: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/option.h:74:25: note: '_opt_infop_' declared here # 74 | extern Opt_t* _opt_infop_; # | ^~~~~~~~~~~ # 179| disc.version = OPT_VERSION; # 180| disc.infof = infof; # 181|-> opt_info.disc = &disc; # 182| if(argc>0) # 183| { Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/print.c:524: error[nullPointer]: Null pointer dereference: 1==(1)?(unsigned char*)0:_ccmap(1,1) # 522| { # 523| if(!mbwide()) # 524|-> c = CCMAPC(c,CC_NATIVE,CC_ASCII); # 525| if(mbwide() && c < 0) /* invalid multibyte char */ # 526| sfputc(sh.stk,'?'); Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/print.c:564: error[nullPointer]: Null pointer dereference: 1==(1)?(unsigned char*)0:_ccmap(1,1) # 562| sfputc(sh.stk,c); # 563| else # 564|-> sfprintf(sh.stk, "%%%02X", CCMAPC(c, CC_NATIVE, CC_ASCII)); # 565| } # 566| } Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/print.c:998: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 996| } # 997| if (format == '.') # 998|-> value->i = value->ll; # 999| if(*lastchar) # 1000| { Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/print.c:1064: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1062| else # 1063| { # 1064|-> value->s = fmtelapsed(value->ll, 1); # 1065| fe->fmt = 's'; # 1066| fe->size = -1; Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/print.c:1074: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1072| n = fe->t_str[fe->n_str]; # 1073| fe->t_str[fe->n_str] = 0; # 1074|-> value->s = fmttmx(fe->t_str, value->ll); # 1075| fe->t_str[fe->n_str] = n; # 1076| } Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/print.c:1077: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1075| fe->t_str[fe->n_str] = n; # 1076| } # 1077|-> else value->s = fmttmx(NULL, value->ll); # 1078| fe->fmt = 's'; # 1079| fe->size = -1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/read.c:308:30: warning[core.NullDereference]: Array access (via field 'c_cc') results in a null pointer dereference # 306| { # 307| delim = ((unsigned)flags)>>(D_FLAG+1); # 308|-> ep->e_nttyparm.c_cc[VEOL] = delim; # 309| ep->e_nttyparm.c_lflag |= ISIG; # 310| tty_set(fd,TCSADRAIN,&ep->e_nttyparm); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/read.c:380:4: warning[deadcode.DeadStores]: Value stored to 'cp' is never read # 378| if(size==0) # 379| { # 380|-> cp = sfreserve(iop,0,0); # 381| c = 0; # 382| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/read.c:538:12: warning[core.NullDereference]: Access to field 'histfp' results in a dereference of a null pointer (loaded from field 'hist_ptr') # 536| #if !SHOPT_SCRIPTONLY # 537| if(flags&S_FLAG) # 538|-> sfwrite(sh.hist_ptr->histfp,(char*)cp,c); # 539| #endif # 540| c = sh.ifstable[*cp++]; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/read.c:585:7: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 583| if(val==0) # 584| val = (char*)(cp-1); # 585|-> if(sh_strchr(ifs,(char*)cp-1)>=0) # 586| { # 587| c = mbsize((char*)cp-1); Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/read.c: scope_hint: In function 'sh_readline' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/read.c:585:28: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'ifs' # 583| if(val==0) # 584| val = (char*)(cp-1); # 585|-> if(sh_strchr(ifs,(char*)cp-1)>=0) # 586| { # 587| c = mbsize((char*)cp-1); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/read.c:756:9: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 754| } # 755| if(cp = (unsigned char*)sfgetr(iop,delim,0)) # 756|-> c = sfvalue(iop); # 757| else if(cp = (unsigned char*)sfgetr(iop,delim,-1)) # 758| c = sfvalue(iop)+1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/read.c:758:9: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 756| c = sfvalue(iop); # 757| else if(cp = (unsigned char*)sfgetr(iop,delim,-1)) # 758|-> c = sfvalue(iop)+1; # 759| val = (char*)cp; # 760| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/read.c:844:3: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 842| done: # 843| if(timeout || (sh.fdstatus[fd]&(IOTTY|IONOSEEK))) # 844|-> sh_popcontext(&buff); # 845| if(was_write) # 846| sfset(iop,SF_WRITE,1); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/read.c:857:2: warning[core.StackAddressEscape]: Address of stack memory associated with local variable 'buff' is still referred to by the global variable 'sh' upon returning to the caller. This will be a dangling reference # 855| if(jmpval > 1) # 856| siglongjmp(*sh.jmplist,jmpval); # 857|-> return jmpval; # 858| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/test.c:86:12: warning[core.NullDereference]: Dereference of null pointer # 84| int c, m=0; # 85| const char *cp=pat; # 86|-> while(c = *cp++) # 87| { # 88| if(c=='(') Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/test.c: scope_hint: In function 'test_strmatch' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/test.c:86:19: warning[-Wanalyzer-null-dereference]: dereference of NULL 'cp' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:36: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:36: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/test.c:28: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/test.c:553:52: note: in expansion of macro 'sfstruse' # 84| int c, m=0; # 85| const char *cp=pat; # 86|-> while(c = *cp++) # 87| { # 88| if(c=='(') Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/test.c:135:20: warning[deadcode.DeadStores]: Although the value stored to 'not' is used in the enclosing expression, the value is never actually read from 'not' # 133| { # 134| /* special case ( binop ) to conform with standard */ # 135|-> if(!(argc==4 && (not=sh_lookup(cp=argv[2],shtab_testops)))) # 136| { # 137| cp = (++argv)[1]; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/test.c:301:5: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'arg') # 299| if(arg && c_eq(arg, '!') && tp->ap < tp->ac) # 300| return !e3(tp); # 301|-> if(c_eq(arg, '(')) # 302| { # 303| op = expr(tp,1); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/trap.c:46:8: warning[deadcode.DeadStores]: Value stored to 'arg' during its initialization is never read # 44| int b_trap(int argc,char *argv[],Shbltin_t *context) # 45| { # 46|-> char *arg = argv[1]; # 47| int sig, clear = 0, dflag = 0, pflag = 0; # 48| NOT_USED(argc); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/typeset.c:1036:15: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 1034| if(flag&NV_GLOBAL) # 1035| { # 1036|-> sh.var_tree = save_vartree; # 1037| #if SHOPT_NAMESPACE # 1038| sh.namespace = save_namespace; Error: CPPCHECK_WARNING (CWE-682): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/typeset.c:1220: error[nullPointerArithmetic]: Pointer addition with NULL pointer. # 1218| #endif /* SHOPT_DYNAMIC */ # 1219| { # 1220|-> if(np = sh_addbuiltin(arg, addr,pointerof(dlete))) # 1221| { # 1222| if(dlete || nv_isattr(np,BLT_SPC)) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/typeset.c:1238:27: warning[deadcode.DeadStores]: Although the value stored to 'np' is used in the enclosing expression, the value is never actually read from 'np' # 1236| addr = funptr(np); # 1237| } # 1238|-> if(!dlete && !addr && !(np=sh_addbuiltin(arg,NULL,0))) # 1239| errmsg = "not found"; # 1240| if(errmsg) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/bltins/typeset.c:1516:5: warning[deadcode.DeadStores]: Value stored to 'flag' is never read # 1514| sfmove(iop,file, nv_size(np), -1); # 1515| else # 1516|-> flag = '\n'; # 1517| if(fname) # 1518| sfclose(iop); Error: CPPCHECK_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/completion.c:51: error[legacyUninitvar]: Uninitialized variable: hc[0] # 49| const char hexp = 0; # 50| #endif /* SHOPT_HISTEXPAND */ # 51|-> if((!hexp || (*cp!=hc[0] && *cp!=hc[2])) && (*cp=='#' || *cp=='~')) # 52| sfputc(sh.stk,'\\'); # 53| mbinit(); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/completion.c:284:7: warning[deadcode.DeadStores]: Value stored to 'c' during its initialization is never read # 282| #if SHOPT_MULTIBYTE # 283| { # 284|-> int c = *cur; # 285| genchar *cp; # 286| /* adjust cur */ Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/completion.c:321:3: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 319| int c; # 320| char *last = out; # 321|-> c = *(unsigned char*)out; # 322| var = mode; # 323| begin = out = find_begin(outbuff,last,0,&var); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/edit.c:842:4: warning[deadcode.DeadStores]: Although the value stored to 'endp' is used in the enclosing expression, the value is never actually read from 'endp' # 840| char *endp, *p=string; # 841| int size, offset = ep->e_lookahead + nbyte; # 842|-> *(endp = &p[nbyte]) = 0; # 843| endp = &p[nbyte]; # 844| do Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:645:10: warning[core.uninitialized.Assign]: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage # 643| count = 2; # 644| skip = 0; # 645|-> oldind -= hp->histind; # 646| hp->histind = hp->histind-hp->histsize + oldind +2; # 647| if(hp->histind<0) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c: scope_hint: In function 'hist_eof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:645:24: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'oldind' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/error.h:32: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:79: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:36: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:43: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:363:51: note: in expansion of macro '__sf_fileno' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:1112:32: note: in expansion of macro 'sffileno' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:298:36: note: in definition of macro '_SF_' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:368:51: note: in expansion of macro '__sf_value' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:575:21: note: in expansion of macro 'sfvalue' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:298:36: note: in definition of macro '_SF_' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:356:51: note: in expansion of macro '__sf_putc' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:641:17: note: in expansion of macro 'sfputc' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:298:36: note: in definition of macro '_SF_' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:356:51: note: in expansion of macro '__sf_putc' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:674:9: note: in expansion of macro 'sfputc' # 643| count = 2; # 644| skip = 0; # 645|-> oldind -= hp->histind; # 646| hp->histind = hp->histind-hp->histsize + oldind +2; # 647| if(hp->histind<0) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:703:17: warning[unix.Malloc]: Use of memory after it is freed # 701| sh_offoption(SH_HISTORY); # 702| } # 703|-> hp->histflush = 0; # 704| } # 705| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:994:30: warning[deadcode.DeadStores]: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' # 992| if(s1==0) # 993| return count; # 994|-> if(count && s1 > s1orig && (c = *(s1 - 1)) == '\n') # 995| s1--; # 996| *s1 = '\0'; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c: scope_hint: In function 'hist_word' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:1015:26: warning[-Wanalyzer-null-dereference]: dereference of NULL 'cp' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:357:51: note: in expansion of macro '__sf_getc' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:972:21: note: in expansion of macro 'sfgetc' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:357:51: note: in expansion of macro '__sf_getc' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:972:21: note: in expansion of macro 'sfgetc' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:357:51: note: in expansion of macro '__sf_getc' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:972:21: note: in expansion of macro 'sfgetc' # 1013| return NULL; # 1014| hist_copy(string,size,(int)hp->histind-1,-1); # 1015|-> for(quoted=0;c = *cp;cp++) # 1016| { # 1017| is_space = isspace(c) && !quoted; Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c: scope_hint: In function 'hist_locate' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/edit/history.c:1094:16: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'next.hist_char' # 1092| next.hist_line = line; # 1093| next.hist_command = command; # 1094|-> return next; # 1095| } # 1096| #endif /* SHOPT_ESH */ Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/name.h:56: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:49: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/arith.c:26: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/arith.c: scope_hint: In function 'arith' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/nval.h:206:38: warning[-Wanalyzer-null-dereference]: dereference of NULL 'np' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/arith.c:243:20: note: in expansion of macro 'nv_isattr' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/arith.c:243:20: note: in expansion of macro 'nv_isattr' # 204| # 205| /* name-value pair macros */ # 206|-> #define nv_isattr(np,f) ((np)->nvflag & (f)) # 207| #define nv_onattr(n,f) ((n)->nvflag |= (f)) # 208| #define nv_offattr(n,f) ((n)->nvflag &= ~(f)) Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:37: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c: scope_hint: In function 'nv_init' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/variables.h:100:28: warning[-Wanalyzer-malloc-leak]: leak of 'sh_calloc(1, 40)' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1929:38: note: in expansion of macro 'SH_VERSIONNOD' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:31: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1822:22: note: in expansion of macro 'sh_newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1822:22: note: in expansion of macro 'sh_newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1928:34: note: in expansion of macro 'sh_newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1928:34: note: in expansion of macro 'sh_newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1929:38: note: in expansion of macro 'SH_VERSIONNOD' # 98| #define SH_SUBSCRNOD (sh.bltin_nodes+50) # 99| #define SH_VALNOD (sh.bltin_nodes+51) # 100|-> #define SH_VERSIONNOD (sh.bltin_nodes+52) # 101| #define SH_MATCHNOD (sh.bltin_nodes+53) # 102| #define SH_COMMANDNOD (sh.bltin_nodes+54) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/args.c:374:4: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges # 372| if(!is_option(&newflags,SH_PRIVILEGED)) # 373| { # 374|-> setuid(sh.userid); # 375| setgid(sh.groupid); # 376| if(sh.euserid==0) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/args.c:375:4: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setgid' is not checked. If an error occurs in 'setgid', the following code may execute with unexpected privileges # 373| { # 374| setuid(sh.userid); # 375|-> setgid(sh.groupid); # 376| if(sh.euserid==0) # 377| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/args.c:580:4: warning[deadcode.DeadStores]: Value stored to 'value' is never read # 578| continue; # 579| on = !!is_option(&oflags,value); # 580|-> value &= 0xff; # 581| name = tp->sh_name; # 582| if(name[0] == 'n' && name[1] == 'o' && name[2] != 't') Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/arith.c:82:19: warning[deadcode.DeadStores]: Although the value stored to 'sub' is used in the enclosing expression, the value is never actually read from 'sub' # 80| && sh_macfun(cp, offset = stktell(sh.stk))) # 81| { # 82|-> Fun = sh_arith(sub=stkptr(sh.stk,offset)); # 83| FunNode.nvalue.ldp = &Fun; # 84| nv_onattr(&FunNode,NV_NOFREE|NV_LDOUBLE|NV_RDONLY); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/arith.c:284:9: warning[deadcode.DeadStores]: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' # 282| break; # 283| dot=NV_NOADD; # 284|-> if((c = *++str) !='[') # 285| continue; # 286| str = nv_endsubscript(NULL,cp=str,0)-1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/arith.c:295:5: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 293| int fsize = str- (char*)(*ptr); # 294| const struct mathtab *tp; # 295|-> c = **ptr; # 296| lvalue->fun = 0; # 297| sfprintf(sh.stk,".sh.math.%.*s%c",fsize,*ptr,0); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/arith.c:382:7: warning[core.NullDereference]: Access to field 'nvflag' results in a dereference of a null pointer (loaded from variable 'np') # 380| lvalue->value = (char*)np; # 381| /* bind subscript later */ # 382|-> if(nv_isattr(np,NV_DOUBLE)==NV_DOUBLE) # 383| lvalue->isfloat=1; # 384| lvalue->flag = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/arith.c:490:12: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 488| nv_putval(&node,np->nvname,0); # 489| if(nv_isattr(&node,NV_NOFREE)) # 490|-> return r=nv_getnum(&node); # 491| } # 492| lvalue->eflag = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/array.c:100:10: warning[deadcode.DeadStores]: Although the value stored to 'fp' is used in the enclosing expression, the value is never actually read from 'fp' # 98| } # 99| #if SHOPT_FIXEDARRAY # 100|-> else if(fp = (struct fixed_array*)ap->fixed) # 101| { # 102| aq->scope = ap; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/array.c: scope_hint: In function 'array_maxindex' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/array.c:183:13: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/name.h:56: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:49: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/array.c:29: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/array.c:1822:25: note: in expansion of macro 'nv_offattr' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/name.h:171:67: note: in expansion of macro '_nv_hasget' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/array.c:1823:29: note: in expansion of macro 'nv_isnull' # 181| { # 182| struct index_array *ap = (struct index_array*)nv_arrayptr(np); # 183|-> int i = ap->maxi; # 184| if(is_associative(ap)) # 185| return -1; Error: GCC_ANALYZER_WARNING (CWE-688): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/expand.c: scope_hint: In function 'path_expand' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/expand.c:116:76: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:36: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:36: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/expand.c:28: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/expand.c:107:30: note: in expansion of macro 'sfstruse' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast_sys.h:10: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast_std.h:66: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:32: included_from: Included from here. /usr/include/string.h:156:12: note: argument 2 of 'strcmp' must be non-null # 114| * argnod (argnod.h); thus, gl_path and argval have the same offset (ARGVAL) in the struct.) # 115| */ # 116|-> if((ap = (struct argnod*)gp->gl_list) && !ap->argnxt.ap && strcmp(ap->argval,trimmedpat)==0) # 117| { # 118| gp->gl_list = (globlist_t*)stkalloc(sh.stk,ARGVAL+strlen(pattern)+1); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/expand.c:402:5: warning[core.CallAndMessage]: 3rd function call argument is an uninitialized value # 400| { # 401| *(rescan - 1) = 0; # 402|-> sfsprintf(pat=tmp,sizeof(tmp),format,first); # 403| *(rescan - 1) = '}'; # 404| *(cp = end) = 0; Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/expand.c: scope_hint: In function 'path_generate' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/expand.c:402:33: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'format' # 400| { # 401| *(rescan - 1) = 0; # 402|-> sfsprintf(pat=tmp,sizeof(tmp),format,first); # 403| *(rescan - 1) = '}'; # 404| *(cp = end) = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/expand.c:438:10: warning[deadcode.DeadStores]: Although the value stored to 'ap' is used in the enclosing expression, the value is never actually read from 'ap' # 436| sfputr(sh.stk,pat,-1); # 437| sfputr(sh.stk,rescan,-1); # 438|-> todo = ap = (struct argnod*)stkfreeze(sh.stk,1); # 439| if(brace == '}') # 440| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/fault.c:337:13: warning[deadcode.DeadStores]: Value stored to 'sig' during its initialization is never read # 335| void sh_sigdone(void) # 336| { # 337|-> int flag, sig = sh.sigmax; # 338| sh.sigflag[0] |= SH_SIGFAULT; # 339| for(sig=sh.sigmax; sig>0; sig--) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/fault.c:600:13: warning[core.NullDereference]: Access to field 'mode' results in a dereference of a null pointer (loaded from variable 'pp') # 598| sh.exitval = (SH_EXITSIG|SIGTSTP); # 599| /* return to prompt mode */ # 600|-> pp->mode = SH_JMPERREXIT; # 601| } # 602| else Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:772:67: warning[deadcode.DeadStores]: Although the value stored to 'pid' is used in the enclosing expression, the value is never actually read from 'pid' # 770| char *cp; # 771| int pid; # 772|-> if(sh_isstate(SH_INIT) && (cp=sh.lastarg) && *cp=='*' && (pid=strtol(cp+1,&cp,10)) && *cp=='*') # 773| nv_putval(np,cp+1,0); # 774| return sh.lastarg; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:891:3: warning[deadcode.DeadStores]: Value stored to 'np' is never read # 889| mp->nodes = sh_calloc(mp->nmatch*(NV_MINSZ+sizeof(void*)+3),1); # 890| mp->names = mp->nodes + mp->nmatch*(NV_MINSZ+sizeof(void*)); # 891|-> np = nv_namptr(mp->nodes,0); # 892| nv_disc(SH_MATCHNOD,&mp->hdr,NV_LAST); # 893| for(i=nmatch; --i>=0;) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:943:27: warning[unix.Malloc]: Use of memory allocated with size zero # 941| v+= mp->first; # 942| memcpy(mp->val+mp->vlen,v,vsize-mp->vlen); # 943|-> mp->val[mp->vlen=vsize] = 0; # 944| mp->lastsub[0] = mp->lastsub[1] = -1; # 945| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1460:4: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges # 1458| if(!sh_isoption(SH_PRIVILEGED) && sh.userid >= SHOPT_P_SUID) # 1459| { # 1460|-> setuid(sh.euserid=sh.userid); # 1461| setgid(sh.egroupid=sh.groupid); # 1462| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1461:4: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setgid' is not checked. If an error occurs in 'setgid', the following code may execute with unexpected privileges # 1459| { # 1460| setuid(sh.euserid=sh.userid); # 1461|-> setgid(sh.egroupid=sh.groupid); # 1462| } # 1463| else Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:1988:3: warning[core.NullDereference]: Access to field 'searchf' results in a dereference of a null pointer (loaded from variable 'treep') # 1986| else # 1987| nv_setsize(np,0); # 1988|-> dtinsert(treep,np); # 1989| if(nv_istable(np)) # 1990| treep = dict; Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c: scope_hint: In function 'nv_mapchar' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:2204:16: warning[-Wanalyzer-malloc-leak]: leak of 'sh_calloc(1, n + 72)' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:2191:14: note: in expansion of macro 'sh_newof' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/init.c:2191:14: note: in expansion of macro 'sh_newof' # 2202| } # 2203| mp->hdr.disc = &TRANS_disc; # 2204|-> return &mp->hdr; # 2205| } Error: GCC_ANALYZER_WARNING (CWE-1341): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/io.c: scope_hint: In function 'sh_close' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/io.c:718:26: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'fd' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/error.h:32: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:45: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/io.c:29: included_from: Included from here. # 716| if(fdnotify) # 717| (*fdnotify)(fd,SH_FDCLOSE); # 718|-> while((r=close(fd)) < 0 && errno==EINTR) # 719| errno = err; # 720| } Error: GCC_ANALYZER_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/io.c: scope_hint: In function 'sh_iomovefd.part.0' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/io.c:909:17: warning[-Wanalyzer-fd-use-without-check]: 'dup' on possibly invalid file descriptor 'fdold' # 907| if(fdold<0 || fdold>2) # 908| return fdold; # 909|-> fdnew = sh_iomovefd(dup(fdold)); # 910| sh.fdstatus[fdnew] = (sh.fdstatus[fdold]&~IOCLEX); # 911| close(fdold); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/io.c:1088:7: warning[deadcode.DeadStores]: Although the value stored to 'ep' is used in the enclosing expression, the value is never actually read from 'ep' # 1086| sfputr(sh.stk,name,0); # 1087| pathcanon(stkptr(sh.stk,1),PATH_PHYSICAL); # 1088|-> sp = ep = stkptr(sh.stk,1); # 1089| if(ep = strrchr(sp,'/')) # 1090| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/io.c:1096:3: warning[deadcode.DeadStores]: Value stored to 'ep' is never read # 1094| else # 1095| { # 1096|-> ep = sp; # 1097| stkseek(sh.stk,0); # 1098| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/io.c:1880:6: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 1878| errno = EINTR; # 1879| fno = sffileno(iop); # 1880|-> if((n=sfvalue(iop))<=0) # 1881| { # 1882| #ifndef FNDELAY Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/io.c:2517:32: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 2515| if(j >= argn) # 2516| break; # 2517|-> sfnputc(outfile,' ',fldsize-strlen(*arg)); # 2518| } # 2519| sfputc(outfile,'\n'); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/jobs.c:988:4: warning[deadcode.DeadStores]: Value stored to 'r' is never read # 986| { # 987| if(pid==0 && job.jobcontrol) # 988|-> r = job_walk(outfile, job_kill,sig, NULL); # 989| if(sig==SIGSTOP && pid==sh.pid && sh_isoption(SH_LOGIN_SHELL)) # 990| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/lex.c:145:6: warning[core.NullDereference]: Access to field '_file' results in a dereference of a null pointer (loaded from variable 'iop') # 143| sfwrite(sh.strbuf,lp->lexd.docend,n); # 144| lp->lexd.docextra += n; # 145|-> if(sffileno(iop)>=0) # 146| lp->lexd.docend = sfsetbuf(iop,iop,0); # 147| else Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/lex.c:926:9: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 924| dolerr: # 925| case S_ERR: # 926|-> if((n=endchar(lp)) == '$') # 927| goto err; # 928| if(c=='*' || (n=sh_lexstates[ST_BRACE][c])!=S_MOD1 && n!=S_MOD2) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/lex.c:931:10: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 929| { # 930| /* see whether inside `...` */ # 931|-> if((n = endchar(lp)) != '`') # 932| goto err; # 933| mode = oldmode(lp); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/lex.c:1084:8: warning[deadcode.DeadStores]: Value stored to 'state' is never read # 1082| errormsg(SH_DICT,ERROR_warn(0),e_lexnested,sh.inlineno); # 1083| if(!(state=lp->lexd.first)) # 1084|-> state = fcfirst(); # 1085| else # 1086| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/macro.c:199:8: warning[deadcode.DeadStores]: Value stored to 'str' during its initialization is never read # 197| { # 198| int flags = argp->argflag; # 199|-> char *str = argp->argval; # 200| Mac_t *mp = (Mac_t*)sh.mac_context; # 201| char **saveargaddr = sh.argaddr; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/macro.c:480:19: warning[core.NullDereference]: Dereference of null pointer # 478| else # 479| { # 480|-> while((n=state[*(unsigned char*)cp++])==0); # 481| c = (cp-1) - first; # 482| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/macro.c:591:4: warning[deadcode.DeadStores]: Value stored to 'first' is never read # 589| sfwrite(stkp,first,c); # 590| } # 591|-> first = fcseek(c+1); # 592| c = mp->pattern; # 593| if(n==S_GRAVE) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/macro.c:668:4: warning[deadcode.DeadStores]: Value stored to 'first' is never read # 666| } # 667| c += (n!=S_EOF); # 668|-> first = fcseek(c); # 669| if(tilde>=0) # 670| tilde_expand2(tilde); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/macro.c:723:5: warning[deadcode.DeadStores]: Value stored to 'first' is never read # 721| } # 722| } # 723|-> first = fcseek(c); # 724| mp->pattern = 4; # 725| mp->arith = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/macro.c:1355:9: warning[deadcode.DeadStores]: Although the value stored to 'd' is used in the enclosing expression, the value is never actually read from 'd' # 1353| { # 1354| idbuff[0] = mode = c; # 1355|-> if((d=fcpeek(0))==c) # 1356| idbuff[1] = fcget(); # 1357| if(type==M_VNAME) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/macro.c:1986:9: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 1984| if(array_assoc(ap)) # 1985| { # 1986|-> if(strcmp(bysub?v:nv_getsub(np),arrmax)>0) # 1987| break; # 1988| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/macro.c:2004:7: warning[deadcode.DeadStores]: Value stored to 'dolmax' is never read # 2002| if(!(v=getdolarg(dolg,&vsize))) # 2003| { # 2004|-> dolmax = dolg; # 2005| break; # 2006| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/macro.c:2288:2: warning[deadcode.DeadStores]: Value stored to 'bufsize' is never read # 2286| newlines = 0; # 2287| sfsetbuf(sp,sp,0); # 2288|-> bufsize = sfvalue(sp); # 2289| /* read command substitution output and put on stack or here-doc */ # 2290| sfpool(sp, NULL, SF_WRITE); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/macro.c:2518:32: warning[deadcode.DeadStores]: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' # 2516| if(n==S_SPACE || n==S_NL) # 2517| { # 2518|-> while(size>0 && ((n=state[c= *(unsigned char*)cp++])==S_SPACE||n==S_NL)) # 2519| size--; # 2520| if(mbwide() && n==S_MBYTE && sh_strchr(mp->ifsp,cp-1)>=0) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/macro.c:2535:32: warning[deadcode.DeadStores]: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' # 2533| mp->patfound = 0; # 2534| if(n==S_DELIM) # 2535|-> while(size>0 && ((n=state[c= *(unsigned char*)cp++])==S_SPACE||n==S_NL)) # 2536| size--; # 2537| if(size<=0) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/main.c:267:11: warning[deadcode.DeadStores]: Although the value stored to 'type' is used in the enclosing expression, the value is never actually read from 'type' # 265| if(sh.st.repl_index > 0) # 266| av[sh.st.repl_index] = sh.st.repl_arg; # 267|-> if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (name = nv_getval(L_ARGNOD)) && (!((type = sh_type(cp = name)) & SH_TYPE_SH))) # 268| { # 269| av[0] = (type & SH_TYPE_LOGIN) ? cp : path_basename(cp); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/main.c:267:26: warning[deadcode.DeadStores]: Although the value stored to 'cp' is used in the enclosing expression, the value is never actually read from 'cp' # 265| if(sh.st.repl_index > 0) # 266| av[sh.st.repl_index] = sh.st.repl_arg; # 267|-> if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (name = nv_getval(L_ARGNOD)) && (!((type = sh_type(cp = name)) & SH_TYPE_SH))) # 268| { # 269| av[0] = (type & SH_TYPE_LOGIN) ? cp : path_basename(cp); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/main.c:452:6: warning[deadcode.DeadStores]: Although the value stored to 'top' is used in the enclosing expression, the value is never actually read from 'top' # 450| exitset(); # 451| /* skip over remaining input */ # 452|-> if(top = fcfile()) # 453| { # 454| while(fcget()>0); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/name.c:555:27: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 553| if(sh.prefix) # 554| { # 555|-> L_ARGNOD->nvalue.nrp = node.nvalue.nrp; # 556| L_ARGNOD->nvflag = node.nvflag; # 557| L_ARGNOD->nvfun = node.nvfun; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/name.c:666:15: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 664| if(flags&NV_GLOBAL) # 665| { # 666|-> sh.var_tree = save_vartree; # 667| #if SHOPT_NAMESPACE # 668| sh.namespace = save_namespace; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/name.c:1550:35: warning[deadcode.DeadStores]: Although the value stored to 'mp' is used in the enclosing expression, the value is never actually read from 'mp' # 1548| if(mp=nv_opensub(np)) # 1549| np = mp; # 1550|-> else if(!array_assoc(ap) && (mp = nv_open(cp,sh.var_tree,NV_NOFAIL|NV_VARNAME|NV_NOARRAY|NV_NOADD)) && nv_isvtree(np)) # 1551| { # 1552| ap->nelem |= ARRAY_TREE; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/name.c:1699:9: warning[core.NullDereference]: Access to field 'ldp' results in a dereference of a null pointer (loaded from variable 'up') # 1697| else # 1698| ld = sh_arith(sp); # 1699|-> if(!up->ldp) # 1700| up->ldp = new_of(Sfdouble_t,0); # 1701| else if(flags&NV_APPEND) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/name.c:1719:9: warning[core.NullDereference]: Access to field 'dp' results in a dereference of a null pointer (loaded from variable 'up') # 1717| else # 1718| d = sh_arith(sp); # 1719|-> if(!up->dp) # 1720| up->dp = new_of(double,0); # 1721| else if(flags&NV_APPEND) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/name.c:1974:15: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 1972| if(dot==0) # 1973| return; # 1974|-> append = strlen(up->cp); # 1975| if(!tofree || size) # 1976| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/name.c:3348:13: warning[core.NullDereference]: Access to field 'nvenv' results in a dereference of a null pointer (loaded from variable 'mp') # 3346| else # 3347| nv_clone(nr,mp,(flags&NV_MOVE)|NV_COMVAR); # 3348|-> mp->nvenv = nvenv; # 3349| if(flags&NV_MOVE) # 3350| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/name.c:3351:77: warning[deadcode.DeadStores]: Although the value stored to 'ap' is used in the enclosing expression, the value is never actually read from 'ap' # 3349| if(flags&NV_MOVE) # 3350| { # 3351|-> if(arraynr && !nv_isattr(nr,NV_MINIMAL) && (mp=(Namval_t*)nr->nvenv) && (ap=nv_arrayptr(mp))) # 3352| { # 3353| nv_putsub(mp,nr->nvname,0); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/name.c:3465:6: warning[core.NullDereference]: Access to field 'nvflag' results in a dereference of a null pointer (loaded from variable 'nq') # 3463| { # 3464| /* cause subscript evaluation and return result */ # 3465|-> if(nv_isarray(nq)) # 3466| ep = nv_getsub(nq); # 3467| else Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvdisc.c:49:8: warning[deadcode.DeadStores]: Although the value stored to 'nfp' is used in the enclosing expression, the value is never actually read from 'nfp' # 47| char *cp; # 48| if((fp = nfp) != NULL && !nv_local) # 49|-> fp = nfp = nfp->next; # 50| nv_local=0; # 51| for(; fp; fp=fp->next) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvdisc.c:120:8: warning[deadcode.DeadStores]: Although the value stored to 'nfp' is used in the enclosing expression, the value is never actually read from 'nfp' # 118| Namarr_t *ap; # 119| if((fp=nfp) != NULL && !nv_local) # 120|-> fp = nfp = nfp->next; # 121| nv_local=0; # 122| if(flags&NV_NODISC) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvdisc.c:913:5: warning[deadcode.DeadStores]: Although the value stored to 'fp' is used in the enclosing expression, the value is never actually read from 'fp' # 911| } # 912| mp->nvfun = fp; # 913|-> if(fp=np->nvfun) # 914| { # 915| if(nv_isattr(mp,NV_EXPORT|NV_MINIMAL) == (NV_EXPORT|NV_MINIMAL)) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtree.c:365:12: warning[core.NullDereference]: Access to field 'nvname' results in a dereference of a null pointer (loaded from variable 'tp') # 363| if(type) # 364| { # 365|-> char *cp=tp->nvname; # 366| if(cp=strrchr(cp,'.')) # 367| cp++; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtree.c:622:16: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'xp') # 620| xp = ep+nv_size(np); # 621| while(--xp>ep && *xp==' '); # 622|-> if(xp>ep || *xp!=' ') # 623| xp++; # 624| if(xp < (ep+nv_size(np))) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtree.c:701:4: warning[deadcode.DeadStores]: Value stored to 'fp' is never read # 699| if(!wp->out) # 700| { # 701|-> fp = nv_stack(np,fp); # 702| if(fp = nv_stack(np,NULL)) # 703| free(fp); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtree.c:909:7: warning[core.NullDereference]: Access to field '_next' results in a dereference of a null pointer (loaded from variable 'outfile') # 907| wp->indent++; # 908| else # 909|-> sfputc(outfile,' '); # 910| wp->array = 0; # 911| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtree.c:1117:3: warning[deadcode.DeadStores]: Value stored to 'fp' is never read # 1115| if(nleft==0) # 1116| { # 1117|-> fp = nv_stack(np,fp); # 1118| if(fp = nv_stack(np,NULL)) # 1119| free(fp); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:291:23: warning[core.NullDereference]: Access to field 'np' results in a dereference of a null pointer (loaded from field 'nrp') # 289| nv_setsize(nq,0); # 290| if(strchr(nq->nvname,'.')) # 291|-> nq->nvalue.nrp->np = findref(dp->nodes,i); # 292| else # 293| nq->nvalue.nrp->np = nv_namptr(pp->childfun.ttype->nodes,i); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:293:23: warning[core.NullDereference]: Access to field 'np' results in a dereference of a null pointer (loaded from field 'nrp') # 291| nq->nvalue.nrp->np = findref(dp->nodes,i); # 292| else # 293|-> nq->nvalue.nrp->np = nv_namptr(pp->childfun.ttype->nodes,i); # 294| nq->nvalue.nrp->root = sh.last_root; # 295| nq->nvalue.nrp->table = pp->np; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:351:10: warning[deadcode.DeadStores]: Value stored to 'root' during its initialization is never read # 349| int save, offset=stktell(sh.stk); # 350| char *cp; # 351|-> Dt_t *root = sh.last_root; # 352| Namval_t *last_table = sh.last_table; # 353| struct Namref *nrp = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:600:15: warning[deadcode.DeadStores]: Although the value stored to 'cp' is used in the enclosing expression, the value is never actually read from 'cp' # 598| sfputr(sh.stk,NV_CLASS,'.'); # 599| sfputr(sh.stk,np->nvname,0); # 600|-> np = nv_open(cp=stkptr(sh.stk,offset), sh.var_tree, NV_NOADD|NV_VARNAME); # 601| stkseek(sh.stk,offset); # 602| if(!np) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:849:6: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 847| if(np->nvenv) # 848| size += strlen((char*)np->nvenv)+1; # 849|-> if(strcmp(&np->nvname[m],NV_DATA)==0 && !nv_type(np)) # 850| continue; # 851| if(qp) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:997:49: warning[deadcode.DeadStores]: Although the value stored to 'size' is used in the enclosing expression, the value is never actually read from 'size' # 995| { # 996| if(nr->nvsize) # 997|-> memcpy((char*)nq->nvalue.cp,nr->nvalue.cp,size=nv_datasize(nr,NULL)); # 998| else # 999| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:1054:7: warning[deadcode.DeadStores]: Although the value stored to 'fp' is used in the enclosing expression, the value is never actually read from 'fp' # 1052| goto skip; # 1053| } # 1054|-> if(fp=nv_hasdisc(nq,&chtype_disc)) # 1055| nv_disc(nq, &pp->childfun.fun, NV_LAST); # 1056| if(tp = (Namtype_t*)nv_hasdisc(nq, &type_disc)) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/nvtype.c:1486:6: warning[core.NullDereference]: Access to field '_next' results in a dereference of a null pointer (loaded from variable 'iop') # 1484| sfmove(iop,out, nv_size(mp), -1); # 1485| else # 1486|-> sfputc(iop,'\n'); # 1487| if(xp) # 1488| sfclose(iop); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/parse.c:739:7: warning[deadcode.DeadStores]: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' # 737| sh_lexskip(lexp,';',1,ST_NESTED); # 738| offset = stktell(sh.stk)-1; # 739|-> if((c=fcpeek(-1))!=';') # 740| break; # 741| /* remove trailing white space */ Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/parse.c:982:23: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 980| { # 981| int n,c; # 982|-> if(lexp->token==0 && strcmp(lexp->arg->argval, SYSTYPESET->nvname)==0) # 983| { # 984| while((c=fcgetc(n))==' ' || c=='\t'); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/parse.c:1182:6: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 1180| tp = &t->lst.lstrit; # 1181| } # 1182|-> *tp = (Shnode_t*)ac; # 1183| lexp->assignok = 0; # 1184| lexp->assignlevel--; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/parse.c:1464:6: warning[core.NullDereference]: Dereference of null pointer # 1462| was_assign = 0; # 1463| argp = lexp->arg; # 1464|-> if(*argp->argval==LBRACE && (flag&SH_FUNDEF) && argp->argval[1]==0) # 1465| { # 1466| lexp->token = LBRACE; Error: CPPCHECK_WARNING (CWE-682): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/parse.c:1952: error[nullPointerArithmetic]: Pointer addition with NULL pointer. # 1950| case '(': # 1951| t = test_expr(lexp,')'); # 1952|-> t = makelist(lexp,TTST|TTEST|TPAREN ,t, (Shnode_t*)pointerof(sh.inlineno)); # 1953| break; # 1954| case '!': Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/path.c:411:17: warning[deadcode.DeadStores]: Although the value stored to 'pp' is used in the enclosing expression, the value is never actually read from 'pp' # 409| Pathcomp_t *pp; # 410| if(val=sh_scoped((PATHNOD))->nvalue.cp) # 411|-> sh.pathlist = pp = path_addpath((Pathcomp_t*)sh.pathlist,val,PATH_PATH); # 412| else # 413| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/path.c:418:3: warning[deadcode.DeadStores]: Value stored to 'pp' is never read # 416| } # 417| if(val=sh_scoped((FPATHNOD))->nvalue.cp) # 418|-> pp = path_addpath((Pathcomp_t*)sh.pathlist,val,PATH_FPATH); # 419| } # 420| Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/path.c:677:12: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 675| if(!pp && !sh_isstate(SH_DEFPATH)) # 676| pp = sh.pathlist; # 677|-> if(pp && strlen(name)<256 && strmatch(name,e_alphanum) && (fno=opentype(name,pp,1))>=0) # 678| { # 679| if(flag >= 2) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/path.c:690:16: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'name') # 688| return 0; # 689| } # 690|-> else if(pp && *name!='/' && flag<3) # 691| path_settrackedalias(name,pp); # 692| return 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/path.c:814:29: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 812| sh_stats(STAT_PATHS); # 813| f = canexecute(stkptr(sh.stk,PATH_OFFSET),isfun); # 814|-> if(isfun && f>=0 && (cp = strrchr(name,'.'))) # 815| { # 816| *cp = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/path.c:932:14: warning[unix.Malloc]: Use of memory after it is freed # 930| if(!(pwd=sh.pwd)) # 931| return (char*)fp; # 932|-> while(*pwd==*fp) # 933| { # 934| if(*pwd++==0) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/path.c:1178:3: warning[unix.Malloc]: Argument to free() is the address of the global variable 'e_dot', which is not memory allocated by malloc() # 1176| if(*path=='.' && path!=opath) # 1177| { # 1178|-> free(path); # 1179| path = path_relative(opath); # 1180| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:218:8: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 216| break; # 217| case A_SWAP: # 218|-> num = sp[-1]; # 219| sp[-1] = *sp; # 220| type = tp[-1]; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:272:15: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 270| continue; # 271| case A_ASSIGNOP: # 272|-> node.nosub = lastsub; # 273| /* FALLTHROUGH */ # 274| case A_STORE: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:329:8: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 327| break; # 328| case A_PLUS: # 329|-> num += sp[-1]; # 330| break; # 331| case A_MINUS: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:332:17: warning[core.UndefinedBinaryOperatorResult]: The left operand of '-' is a garbage value due to array index out of bounds # 330| break; # 331| case A_MINUS: # 332|-> num = sp[-1] - num; # 333| break; # 334| case A_TIMES: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:335:8: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 333| break; # 334| case A_TIMES: # 335|-> num *= sp[-1]; # 336| break; # 337| case A_POW: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:338:10: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 336| break; # 337| case A_POW: # 338|-> num = pow(sp[-1],num); # 339| break; # 340| case A_MOD: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:344:35: warning[core.UndefinedBinaryOperatorResult]: The left operand of '%' is a garbage value due to array index out of bounds # 342| arith_error(e_divzero,ep->expr,ep->emode); # 343| if(type==2 || tp[-1]==2) # 344|-> num = U2F((Sfulong_t)(sp[-1]) % (Sfulong_t)(num)); # 345| else # 346| num = (Sflong_t)(sp[-1]) % (Sflong_t)(num); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:346:30: warning[core.UndefinedBinaryOperatorResult]: The left operand of '%' is a garbage value due to array index out of bounds # 344| num = U2F((Sfulong_t)(sp[-1]) % (Sfulong_t)(num)); # 345| else # 346|-> num = (Sflong_t)(sp[-1]) % (Sflong_t)(num); # 347| break; # 348| case A_DIV: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:351:17: warning[core.UndefinedBinaryOperatorResult]: The left operand of '/' is a garbage value due to array index out of bounds # 349| if(type==1 || tp[-1]==1) # 350| { # 351|-> num = sp[-1]/num; # 352| type = 1; # 353| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:357:35: warning[core.UndefinedBinaryOperatorResult]: The left operand of '/' is a garbage value due to array index out of bounds # 355| arith_error(e_divzero,ep->expr,ep->emode); # 356| else if(type==2 || tp[-1]==2) # 357|-> num = U2F((Sfulong_t)(sp[-1]) / (Sfulong_t)(num)); # 358| else # 359| num = (Sflong_t)(sp[-1]) / (Sflong_t)(num); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:359:30: warning[core.UndefinedBinaryOperatorResult]: The left operand of '/' is a garbage value due to array index out of bounds # 357| num = U2F((Sfulong_t)(sp[-1]) / (Sfulong_t)(num)); # 358| else # 359|-> num = (Sflong_t)(sp[-1]) / (Sflong_t)(num); # 360| break; # 361| case A_LSHIFT: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:363:35: warning[core.UndefinedBinaryOperatorResult]: The left operand of '<<' is a garbage value due to array index out of bounds # 361| case A_LSHIFT: # 362| if(tp[-1]==2) # 363|-> num = U2F((Sfulong_t)(sp[-1]) << (long)(num)); # 364| else # 365| num = (Sflong_t)(sp[-1]) << (long)(num); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:365:30: warning[core.UndefinedBinaryOperatorResult]: The left operand of '<<' is a garbage value due to array index out of bounds # 363| num = U2F((Sfulong_t)(sp[-1]) << (long)(num)); # 364| else # 365|-> num = (Sflong_t)(sp[-1]) << (long)(num); # 366| break; # 367| case A_RSHIFT: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:369:35: warning[core.UndefinedBinaryOperatorResult]: The left operand of '>>' is a garbage value due to array index out of bounds # 367| case A_RSHIFT: # 368| if(tp[-1]==2) # 369|-> num = U2F((Sfulong_t)(sp[-1]) >> (long)(num)); # 370| else # 371| num = (Sflong_t)(sp[-1]) >> (long)(num); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:371:30: warning[core.UndefinedBinaryOperatorResult]: The left operand of '>>' is a garbage value due to array index out of bounds # 369| num = U2F((Sfulong_t)(sp[-1]) >> (long)(num)); # 370| else # 371|-> num = (Sflong_t)(sp[-1]) >> (long)(num); # 372| break; # 373| case A_XOR: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:375:35: warning[core.UndefinedBinaryOperatorResult]: The left operand of '^' is a garbage value due to array index out of bounds # 373| case A_XOR: # 374| if(type==2 || tp[-1]==2) # 375|-> num = U2F((Sfulong_t)(sp[-1]) ^ (Sfulong_t)(num)); # 376| else # 377| num = (Sflong_t)(sp[-1]) ^ (Sflong_t)(num); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:377:30: warning[core.UndefinedBinaryOperatorResult]: The left operand of '^' is a garbage value due to array index out of bounds # 375| num = U2F((Sfulong_t)(sp[-1]) ^ (Sfulong_t)(num)); # 376| else # 377|-> num = (Sflong_t)(sp[-1]) ^ (Sflong_t)(num); # 378| break; # 379| case A_OR: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:381:35: warning[core.UndefinedBinaryOperatorResult]: The left operand of '|' is a garbage value due to array index out of bounds # 379| case A_OR: # 380| if(type==2 || tp[-1]==2) # 381|-> num = U2F((Sfulong_t)(sp[-1]) | (Sfulong_t)(num)); # 382| else # 383| num = (Sflong_t)(sp[-1]) | (Sflong_t)(num); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:383:30: warning[core.UndefinedBinaryOperatorResult]: The left operand of '|' is a garbage value due to array index out of bounds # 381| num = U2F((Sfulong_t)(sp[-1]) | (Sfulong_t)(num)); # 382| else # 383|-> num = (Sflong_t)(sp[-1]) | (Sflong_t)(num); # 384| break; # 385| case A_AND: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:387:35: warning[core.UndefinedBinaryOperatorResult]: The left operand of '&' is a garbage value due to array index out of bounds # 385| case A_AND: # 386| if(type==2 || tp[-1]==2) # 387|-> num = U2F((Sfulong_t)(sp[-1]) & (Sfulong_t)(num)); # 388| else # 389| num = (Sflong_t)(sp[-1]) & (Sflong_t)(num); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:389:30: warning[core.UndefinedBinaryOperatorResult]: The left operand of '&' is a garbage value due to array index out of bounds # 387| num = U2F((Sfulong_t)(sp[-1]) & (Sfulong_t)(num)); # 388| else # 389|-> num = (Sflong_t)(sp[-1]) & (Sflong_t)(num); # 390| break; # 391| case A_EQ: Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:392:17: warning[core.UndefinedBinaryOperatorResult]: The left operand of '==' is a garbage value due to array index out of bounds # 390| break; # 391| case A_EQ: # 392|-> num = (sp[-1]==num); # 393| type=0; # 394| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:396:17: warning[core.UndefinedBinaryOperatorResult]: The left operand of '!=' is a garbage value due to array index out of bounds # 394| break; # 395| case A_NEQ: # 396|-> num = (sp[-1]!=num); # 397| type=0; # 398| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:400:17: warning[core.UndefinedBinaryOperatorResult]: The left operand of '<=' is a garbage value due to array index out of bounds # 398| break; # 399| case A_LE: # 400|-> num = (sp[-1]<=num); # 401| type=0; # 402| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:404:17: warning[core.UndefinedBinaryOperatorResult]: The left operand of '>=' is a garbage value due to array index out of bounds # 402| break; # 403| case A_GE: # 404|-> num = (sp[-1]>=num); # 405| type=0; # 406| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:408:17: warning[core.UndefinedBinaryOperatorResult]: The left operand of '>' is a garbage value due to array index out of bounds # 406| break; # 407| case A_GT: # 408|-> num = (sp[-1]>num); # 409| type=0; # 410| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:412:17: warning[core.UndefinedBinaryOperatorResult]: The left operand of '<' is a garbage value due to array index out of bounds # 410| break; # 411| case A_LT: # 412|-> num = (sp[-1]<num); # 413| type=0; # 414| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:417:30: warning[core.UndefinedBinaryOperatorResult]: The right operand of '+' is a garbage value # 415| case A_CALL1F: # 416| sp--,tp--; # 417|-> fun = *((Math_f*)(ep->code+(int)(*sp))); # 418| type = *tp; # 419| if(c&T_BINARY) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:431:30: warning[core.UndefinedBinaryOperatorResult]: The right operand of '+' is a garbage value # 429| case A_CALL1I: # 430| sp--,tp--; # 431|-> fun = *((Math_f*)(ep->code+(int)(*sp))); # 432| type = *tp; # 433| num = (*((Math_1i_f)fun))(num); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:437:30: warning[core.UndefinedBinaryOperatorResult]: The right operand of '+' is a garbage value # 435| case A_CALL2F: # 436| sp-=2,tp-=2; # 437|-> fun = *((Math_f*)(ep->code+(int)(*sp))); # 438| type = *tp; # 439| if(c&T_BINARY) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:455:30: warning[core.UndefinedBinaryOperatorResult]: The right operand of '+' is a garbage value # 453| case A_CALL2I: # 454| sp-=2,tp-=2; # 455|-> fun = *((Math_f*)(ep->code+(int)(*sp))); # 456| type = *tp; # 457| num = (*((Math_2i_f)fun))(sp[1],num); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/streval.c:461:30: warning[core.UndefinedBinaryOperatorResult]: The right operand of '+' is a garbage value # 459| case A_CALL3F: # 460| sp-=3,tp-=3; # 461|-> fun = *((Math_f*)(ep->code+(int)(*sp))); # 462| type = *tp; # 463| if(c&T_BINARY) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/subshell.c:169:5: warning[core.NullDereference]: Access to field 'pipe' results in a dereference of a null pointer (loaded from variable 'sp') # 167| trap = sh_strdup(trap); # 168| /* see whether inside $(...) */ # 169|-> if(sp->pipe) # 170| sh_subtmpfile(); # 171| sh.curenv = 0; Error: GCC_ANALYZER_WARNING (CWE-1341): ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/subshell.c: scope_hint: In function 'sh_subshell' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/subshell.c:738:31: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor '1' ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/fault.h:27: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/shell.h:40: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:69: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/subshell.c:28: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/error.h:32: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/include/defs.h:45: included_from: Included from here. # 736| { # 737| int err=errno; # 738|-> while(close(1)<0 && errno==EINTR) # 739| errno = err; # 740| if (fcntl(sp->tmpfd,F_DUPFD,1) != 1) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/tdump.c:235:8: warning[deadcode.DeadStores]: Although the value stored to 'cp' is used in the enclosing expression, the value is never actually read from 'cp' # 233| int n; # 234| argv = dol->dolval+ARG_SPARE; # 235|-> while(cp = *argv) # 236| argv++; # 237| n = argv - (dol->dolval+1); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/xec.c:1117:9: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'com0') # 1115| if(!np) # 1116| { # 1117|-> if(*com0 == '/' && !sh_isoption(SH_RESTRICTED)) # 1118| { # 1119| /* Check for path-bound builtin referenced by absolute canonical path, in Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/xec.c:1273:21: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 1271| sfpool(sfstderr,sh.outpool,SF_WRITE); # 1272| sfpool(sfstdin,NULL,SF_WRITE); # 1273|-> sh.nextprompt = save_prompt; # 1274| } # 1275| sh_popcontext(buffp); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/xec.c:1842:19: warning[core.NullDereference]: Dereference of null pointer # 1840| } # 1841| /* repeat until end of pipeline */ # 1842|-> while(!type && t->tre.tretyp==TFIL); # 1843| sh.inpipe = pvn; # 1844| sh.outpipe = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/xec.c:2306:4: warning[core.UndefinedBinaryOperatorResult]: The right operand of '-' is a garbage value # 2304| get_cpu_times(&after_usr, &after_sys); # 2305| timeofday(&ta); # 2306|-> timersub(&ta, &tb, &tm[TM_REAL_IDX]); /* calculate elapsed real-time */ # 2307| timersub(&after_usr, &before_usr, &tm[TM_USR_IDX]); # 2308| timersub(&after_sys, &before_sys, &tm[TM_SYS_IDX]); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/xec.c:2345:15: warning[deadcode.DeadStores]: Value stored to 'oldnspace' during its initialization is never read # 2343| { # 2344| Dt_t *root; # 2345|-> Namval_t *oldnspace = sh.namespace; # 2346| int offset = stktell(sh.stk); # 2347| int flags=NV_NOARRAY|NV_VARNAME; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/xec.c:2363:5: warning[deadcode.DeadStores]: Value stored to 'offset' is never read # 2361| sfputr(sh.stk,fname,0); # 2362| np = nv_open(stkptr(sh.stk,offset),sh.var_tree,flags); # 2363|-> offset = stktell(sh.stk); # 2364| if(nv_istable(np)) # 2365| root = nv_dict(np); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/xec.c:2365:6: warning[deadcode.DeadStores]: Value stored to 'root' is never read # 2363| offset = stktell(sh.stk); # 2364| if(nv_istable(np)) # 2365|-> root = nv_dict(np); # 2366| else # 2367| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/xec.c:2711:7: warning[core.NullDereference]: Dereference of null pointer # 2709| nl = (nl?'\n':-1); # 2710| /* don't quote [ and [[ */ # 2711|-> if(*(cp=argv[0])=='[' && (!cp[1] || !cp[2]&&cp[1]=='[')) # 2712| { # 2713| sfputr(sfstderr,cp,*++argv?' ':nl); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/xec.c:2943:2: warning[core.uninitialized.UndefReturn]: Undefined or garbage value returned to caller # 2941| SH_VALNOD->nvenv = node.nvenv; # 2942| SH_VALNOD->nvalue.ldp = node.nvalue.ldp; # 2943|-> return d; # 2944| } # 2945| Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/xec.c:3148:8: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 3146| int loopcnt = sh.st.loopcnt; # 3147| sh.posix_fun = np; # 3148|-> save = argv[-1]; # 3149| argv[-1] = 0; # 3150| sh.st.funname = nv_name(np); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/cmd/ksh93/sh/xec.c:3412:8: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 3410| struct stat statb; # 3411| sfprintf(sh.strbuf,"/dev/fd/%d",fd); # 3412|-> if(stat(devfd=sfstruse(sh.strbuf),&statb)>=0) # 3413| argv[0] = devfd; # 3414| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/cdt/dthash.c:307:20: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'tbl') # 305| tbl = hash->htbl + (hsh & (hash->tblz-1)); # 306| pp = ll = NULL; /* pp is the before, ll is the here */ # 307|-> for(p = NULL, l = *tbl; l; p = l, l = l->_rght) # 308| { if(hsh == l->_hash) # 309| { o = _DTOBJ(disc,l); k = _DTKEY(disc,o); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/cdt/dtview.c:48:12: warning[core.NullDereference]: Access to field 'walk' results in a dereference of a null pointer (loaded from variable 'dt') # 46| if((o = (*(d->meth->searchf))(d,obj,type)) ) # 47| break; # 48|-> dt->walk = d; # 49| return o; # 50| } Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/cdt/dtview.c: scope_hint: In function 'dtvsearch.part.0' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/cdt/dtview.c:48:26: warning[-Wanalyzer-null-dereference]: dereference of NULL 'dt' # 46| if((o = (*(d->meth->searchf))(d,obj,type)) ) # 47| break; # 48|-> dt->walk = d; # 49| return o; # 50| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/iconv.c:661:4: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 659| if (!mbwide()) # 660| { # 661|-> c = 1; # 662| w = *f; # 663| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/regcmp.c:75:18: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'pattern') # 73| # 74| va_start(ap, pattern); # 75|-> if (pattern || !*pattern || !(sp = sfstropen())) # 76| e = 1; # 77| else Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/regcmp.c: scope_hint: In function 'regcmp' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/regcmp.c:75:25: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 73| # 74| va_start(ap, pattern); # 75|-> if (pattern || !*pattern || !(sp = sfstropen())) # 76| e = 1; # 77| else Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/setlocale.c: scope_hint: In function 'debug_strxfrm' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/setlocale.c:317:76: warning[-Wchar-subscripts]: array subscript has type 'char' # 317 | *t++ = debug_order[*q]; # | ^~ # 315| for (q = s + 2; q < r; q++) # 316| if (t < e) # 317|-> *t++ = debug_order[*q]; # 318| while (w++ < DX) # 319| if (t < e) Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/setlocale.c:332:61: warning[-Wchar-subscripts]: array subscript has type 'char' # 332 | *t++ = debug_order[s[0]]; # | ~^~~ # 330| { # 331| if (t < e) # 332|-> *t++ = debug_order[s[0]]; # 333| if (t < e) # 334| *t++ = debug_order[s[1]]; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/setlocale.c:334:61: warning[-Wchar-subscripts]: array subscript has type 'char' # 334 | *t++ = debug_order[s[1]]; # | ~^~~ # 332| *t++ = debug_order[s[0]]; # 333| if (t < e) # 334|-> *t++ = debug_order[s[1]]; # 335| if (t < e) # 336| *t++ = 1; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/setlocale.c:349:61: warning[-Wchar-subscripts]: array subscript has type 'char' # 349 | *t++ = debug_order[s[0]]; # | ~^~~ # 347| { # 348| if (t < e) # 349|-> *t++ = debug_order[s[0]]; # 350| if (t < e) # 351| *t++ = debug_order[s[1]]; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/setlocale.c:351:61: warning[-Wchar-subscripts]: array subscript has type 'char' # 351 | *t++ = debug_order[s[1]]; # | ~^~~ # 349| *t++ = debug_order[s[0]]; # 350| if (t < e) # 351|-> *t++ = debug_order[s[1]]; # 352| if (t < e) # 353| *t++ = debug_order[s[2]]; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/setlocale.c:353:61: warning[-Wchar-subscripts]: array subscript has type 'char' # 353 | *t++ = debug_order[s[2]]; # | ~^~~ # 351| *t++ = debug_order[s[1]]; # 352| if (t < e) # 353|-> *t++ = debug_order[s[2]]; # 354| if (t < e) # 355| *t++ = 1; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/setlocale.c:364:53: warning[-Wchar-subscripts]: array subscript has type 'char' # 364 | *t++ = debug_order[s[0]]; # | ~^~~ # 362| { # 363| if (t < e) # 364|-> *t++ = debug_order[s[0]]; # 365| if (t < e) # 366| *t++ = 1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/setlocale.c:2433:66: warning[core.NullDereference]: Array access (via field 'name') results in a null pointer dereference # 2431| return NULL; # 2432| } # 2433|-> if ((lc->flags & LC_default) || category == AST_LC_MESSAGES && lc->name[0] == 'e' && lc->name[1] == 'n' && (lc->name[2] == 0 || lc->name[2] == '_' && lc->name[3] == 'U')) # 2434| ast.locale.set &= ~(1<<category); # 2435| else Error: CPPCHECK_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/strtold.c: error[internalError]: Internal Error. MathLib::toDoubleNumber: conversion failed: 1.18973149535723176502126385303097021e+4932L Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/wordexp.c:166:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'av' # 164| if(!(cp = (char*)malloc(sizeof(char*)+c))) # 165| { # 166|-> c=WRDE_NOSPACE; # 167| goto err; # 168| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/wordexp.c:169:27: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 167| goto err; # 168| } # 169|-> ((struct list*)cp)->next = (struct list*)(*av); # 170| *av++ = (char*)cp; # 171| cp += sizeof(char*); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/wordexp.c:183:9: warning[deadcode.DeadStores]: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' # 181| *av++ = cp; # 182| sh_unquote(cp); # 183|-> while(c= *cp++); # 184| } # 185| *av = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/disc/sfdcfilter.c:103:2: warning[deadcode.DeadStores]: Value stored to 'addr' is never read # 101| static Sfoff_t filterseek(Sfio_t* f, Sfoff_t addr, int offset, Sfdisc_t* disc) # 102| { f = NULL; # 103|-> addr = 0; # 104| offset = 0; # 105| disc = NULL; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/disc/sfdcfilter.c:104:2: warning[deadcode.DeadStores]: Value stored to 'offset' is never read # 102| { f = NULL; # 103| addr = 0; # 104|-> offset = 0; # 105| disc = NULL; # 106| return (Sfoff_t)(-1); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/disc/sfdcmore.c:150:8: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 's') # 148| if (s >= e) # 149| return n; # 150|-> if (*s == '\n') # 151| b = s + 1; # 152| else if (*s == r && (e - s) >= more->match && !strncmp(s, more->pattern, more->match)) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/disc/sfdcmore.c: scope_hint: In function 'morewrite.part.0' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/disc/sfdcmore.c:150:29: warning[-Wanalyzer-null-dereference]: dereference of NULL 's' # 148| if (s >= e) # 149| return n; # 150|-> if (*s == '\n') # 151| b = s + 1; # 152| else if (*s == r && (e - s) >= more->match && !strncmp(s, more->pattern, more->match)) Error: CPPCHECK_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/disc/sfdcmore.c:311: error[memleak]: Memory leak: more # 309| { # 310| sfdisc(f, SF_POPDISC); # 311|-> return -1; # 312| } # 313| more->input = sfstdin; Error: CPPCHECK_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/disc/sfdcmore.c:317: error[memleak]: Memory leak: more # 315| { # 316| sfdisc(f, SF_POPDISC); # 317|-> return -1; # 318| } # 319| more->error = sfstdin; Error: CPPCHECK_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/disc/sfdcmore.c:322: error[memleak]: Memory leak: more # 320| } # 321| # 322|-> return 0; # 323| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/disc/sfdcprefix.c:71:8: warning[deadcode.DeadStores]: Although the value stored to 's' is used in the enclosing expression, the value is never actually read from 's' # 69| sfwr(f, pfx->prefix, n > 1 ? pfx->length : pfx->empty, dp); # 70| w += sfwr(f, s, n, dp); # 71|-> if ((s = t + 1) >= e) # 72| return w; # 73| } while ((s = t + 1) < e); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/disc/sfkeyprintf.c:184:43: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 182| { # 183| *v = 0; # 184|-> if (i == ':' && fp->fmt.fmt == 's' && strlen(a) > 4 && !isalnum(*(a + 4))) # 185| { # 186| d = *(a + 4); Error: CPPCHECK_WARNING (CWE-682): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/disc/sfkeyprintf.c:232: error[nullPointerArithmetic]: Pointer addition with NULL pointer. # 230| if (s) # 231| n = strtoll(s, NULL, 0); # 232|-> value->p = pointerof(n); # 233| break; # 234| case 'q': Error: GCC_ANALYZER_WARNING (CWE-404): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashalloc.c: scope_hint: In function 'hashalloc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashalloc.c:148:33: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashlib.h:29: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashalloc.c:28: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashalloc.c:83:40: note: in expansion of macro 'newof' # 146| if (vp < &va[elementsof(va)]) # 147| { # 148|-> va_copy(*vp, ap); # 149| vp++; # 150| } Error: GCC_ANALYZER_WARNING (CWE-404): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashalloc.c:162:25: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashalloc.c:66:26: note: in expansion of macro 'newof' # 160| } # 161| #else # 162|-> va_copy(ap, va_listval(va_arg(ap, va_listarg))); # 163| #endif # 164| break; Error: GCC_ANALYZER_WARNING (CWE-404): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashalloc.c:169:33: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashalloc.c:83:40: note: in expansion of macro 'newof' # 167| { # 168| vp--; # 169|-> va_copy(ap, *vp); # 170| break; # 171| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashfree.c:86:16: warning[unix.Malloc]: Use of memory after it is freed # 84| { # 85| p->hash &= ~HASH_HIDES; # 86|-> p->name = ((Hash_bucket_t*)p->name)->name; # 87| } # 88| } Error: GCC_ANALYZER_WARNING (CWE-416): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashfree.c: scope_hint: In function 'hashfree' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashfree.c:86:76: warning[-Wanalyzer-use-after-free]: use after 'free' of '*b.name' # 84| { # 85| p->hash &= ~HASH_HIDES; # 86|-> p->name = ((Hash_bucket_t*)p->name)->name; # 87| } # 88| } Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashlook.c:48: warning[nullPointer]: Possible null pointer dereference: (unsigned int*)value # 46| int c; # 47| # 48|-> if (flags & HASH_HASHED) n = *((unsigned int*)value); # 49| else # 50| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashlook.c:84:32: warning[core.NullDereference]: Access to field 'hash' results in a dereference of a null pointer (loaded from field 'bucket') # 82| else last->bucket = 0; # 83| last->name = name; # 84|-> if (flags & HASH_BUCKET) n = last->bucket->hash; # 85| else if (tab->flags & HASH_HASHED) # 86| { Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashlook.c: scope_hint: In function 'hashlook' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashlook.c:90:49: warning[-Wanalyzer-null-dereference]: dereference of NULL 'value' # 88| if (!(flags & HASH_HASHED)) n >>= 3; # 89| } # 90|-> else if (flags & HASH_HASHED) n = *((unsigned int*)value); # 91| else HASH(tab->root, name, n); # 92| last->hash = i = HASHVAL(n); Error: GCC_ANALYZER_WARNING (CWE-688): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashlook.c:207:41: warning[-Wanalyzer-null-argument]: use of NULL 'value' where non-null expected <built-in>: note: argument 2 of '__builtin_memcpy' must be non-null # 205| else if (b->name && tab->root->namesize) # 206| { # 207|-> memcpy(b->name, value, tab->root->namesize); # 208| name = 0; # 209| } Error: GCC_ANALYZER_WARNING (CWE-688): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashlook.c:218:45: warning[-Wanalyzer-null-argument]: use of NULL 'value' where non-null expected <built-in>: note: argument 1 of '__builtin_strlen' must be non-null # 216| i = (sizeof(Hash_bucket_t) + sizeof(char*) - 1) / sizeof(char*); # 217| i *= sizeof(char*); # 218|-> m = strlen(value); # 219| if (b->name == ((char*)b + i) && strlen(b->name) <= m) # 220| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/hash/hashlook.c:327:10: warning[core.NullDereference]: Access to field 'hash' results in a dereference of a null pointer (loaded from variable 'b') # 325| } # 326| } # 327|-> b->hash = n = i; # 328| HASHMOD(tab, n); # 329| b->next = tab->table[n]; Error: GCC_ANALYZER_WARNING (CWE-775): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/systrace.c:26: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/systrace.c: scope_hint: In function 'systrace' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/proc.h:68:85: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open("/dev/null", 1)' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/proc.h:72:33: note: in expansion of macro 'PROC_op2' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/systrace.c:55:17: note: in expansion of macro 'PROC_FD_DUP' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/proc.h:68:88: note: in definition of macro 'PROC_op2' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/systrace.c:55:17: note: in expansion of macro 'PROC_FD_DUP' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/proc.h:72:33: note: in expansion of macro 'PROC_op2' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/systrace.c:55:17: note: in expansion of macro 'PROC_FD_DUP' # 66| # 67| #define PROC_op1(o,a) (((o)<<(2*PROC_ARG_BIT))|((a)&((PROC_ARG_NULL<<PROC_ARG_BIT)|PROC_ARG_NULL))) # 68|-> #define PROC_op2(o,a,b) (((o)<<(2*PROC_ARG_BIT))|(((b)&PROC_ARG_NULL)<<PROC_ARG_BIT)|((a)&PROC_ARG_NULL)) # 69| # 70| #define PROC_FD_CLOSE(p,f) PROC_op2(PROC_fd_dup|(f),p,PROC_ARG_NULL) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/ast.h:36: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optlib.h:30: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:30: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c: scope_hint: In function 'expand' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/sfio.h:395:37: warning[-Wanalyzer-null-dereference]: dereference of NULL 'ip' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:838:13: note: in expansion of macro 'sfstrtell' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/error.h:31: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optlib.h:109: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:5738:17: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4302:24: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:838:13: note: in expansion of macro 'sfstrtell' # 393| # 394| #define sfstrsize(f) ((f)->_size) # 395|-> #define sfstrtell(f) ((f)->_next - (f)->_data) # 396| #define sfstrpend(f) ((f)->_size - sfstrtell()) # 397| #define sfstrbase(f) ((char*)(f)->_data) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:357:9: warning[deadcode.DeadStores]: Although the value stored to 'j' is used in the enclosing expression, the value is never actually read from 'j' # 355| if (!pattern || !*pattern) # 356| pattern = "*"; # 357|-> i += (j = 2 * (strlen(pattern) + 1)); # 358| if (!(fp = (Find_t*)vmnewof(vm, 0, Find_t, 1, i))) # 359| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:651:5: warning[core.NullDereference]: Access to field 'disc' results in a dereference of a null pointer (loaded from variable 'fp') # 649| nomemory: # 650| if (disc->errorf) # 651|-> (*fp->disc->errorf)(fp, fp->disc, 2, "out of memory"); # 652| if (!vm) # 653| return NULL; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:651:5: warning[core.NullDereference]: Access to field 'disc' results in a dereference of an undefined pointer value (loaded from variable 'fp') # 649| nomemory: # 650| if (disc->errorf) # 651|-> (*fp->disc->errorf)(fp, fp->disc, 2, "out of memory"); # 652| if (!vm) # 653| return NULL; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:651:21: warning[-Wanalyzer-null-dereference]: dereference of NULL 'fp' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/findlib.h:33: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:76: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/vmalloc.h:285:37: note: in expansion of macro 'vmresize' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:174:37: note: in expansion of macro 'vmnewof' # 649| nomemory: # 650| if (disc->errorf) # 651|-> (*fp->disc->errorf)(fp, fp->disc, 2, "out of memory"); # 652| if (!vm) # 653| return NULL; Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c: scope_hint: In function 'findopen' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:651:21: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'fp' # 649| nomemory: # 650| if (disc->errorf) # 651|-> (*fp->disc->errorf)(fp, fp->disc, 2, "out of memory"); # 652| if (!vm) # 653| return NULL; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:815:16: warning[core.UndefinedBinaryOperatorResult]: The left operand of '-' is a garbage value # 813| */ # 814| # 815|-> if ((n = p - fp->decode.path + 1) > (m = *fp->lens)) # 816| { # 817| if (!(*fp->dirs)[m]) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c: scope_hint: In function 'findread' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:815:44: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'p' # 813| */ # 814| # 815|-> if ((n = p - fp->decode.path + 1) > (m = *fp->lens)) # 816| { # 817| if (!(*fp->dirs)[m]) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:845:22: warning[core.NullDereference]: Dereference of undefined pointer value (loaded from variable 'p') # 843| fp->lens++; # 844| } # 845|-> if (fp->verify && (*p == '/' || t == 1)) # 846| { # 847| if ((n = p - fp->decode.path)) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:845:36: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'p' # 843| fp->lens++; # 844| } # 845|-> if (fp->verify && (*p == '/' || t == 1)) # 846| { # 847| if ((n = p - fp->decode.path)) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:852:5: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 850| n = 1; # 851| if (fp->verifyf) # 852|-> n = (*fp->verifyf)(fp, fp->decode.path, n, fp->disc); # 853| else if (stat(fp->decode.path, &st)) # 854| n = -1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:854:5: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 852| n = (*fp->verifyf)(fp, fp->decode.path, n, fp->disc); # 853| else if (stat(fp->decode.path, &st)) # 854|-> n = -1; # 855| else if ((unsigned long)st.st_mtime > fp->stamp) # 856| n = 1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:856:5: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 854| n = -1; # 855| else if ((unsigned long)st.st_mtime > fp->stamp) # 856|-> n = 1; # 857| else # 858| n = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:858:5: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 856| n = 1; # 857| else # 858|-> n = 0; # 859| *p = '/'; # 860| Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:869:7: warning[core.UndefinedBinaryOperatorResult]: The left operand of '>>' is a garbage value # 867| /* NOT IMPLEMENTED YET */ # 868| } # 869|-> if (FF_OK_TYPE(fp, t)) # 870| { # 871| if (fp->decode.end) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:873:13: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 871| if (fp->decode.end) # 872| { # 873|-> if (*(s = p) == '/') # 874| s--; # 875| if (*fp->decode.pattern == '/' && b > fp->decode.path) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:873:37: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'p' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:869:21: note: in expansion of macro 'FF_OK_TYPE' # 871| if (fp->decode.end) # 872| { # 873|-> if (*(s = p) == '/') # 874| s--; # 875| if (*fp->decode.pattern == '/' && b > fp->decode.path) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:902:9: warning[core.NullDereference]: Dereference of undefined pointer value (loaded from variable 'p') # 900| { # 901| fp->decode.peek = c; # 902|-> if (*p == '/' && p > fp->decode.path) # 903| *(fp->decode.restore = p) = 0; # 904| if (!fp->secure || !access(fp->decode.path, F_OK)) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:902:37: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'p' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:869:21: note: in expansion of macro 'FF_OK_TYPE' # 900| { # 901| fp->decode.peek = c; # 902|-> if (*p == '/' && p > fp->decode.path) # 903| *(fp->decode.restore = p) = 0; # 904| if (!fp->secure || !access(fp->decode.path, F_OK)) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/findlib.h:50:72: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 't' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:869:21: note: in expansion of macro 'FF_OK_TYPE' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:869:21: note: in expansion of macro 'FF_OK_TYPE' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:869:21: note: in expansion of macro 'FF_OK_TYPE' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fastfind.c:869:21: note: in expansion of macro 'FF_OK_TYPE' # 48| # 49| #define FF_SET_TYPE(p,i) ((p)->decode.bigram1[((i)>>3)&((1<<CHAR_BIT)-1)]|=(1<<((i)&07))) # 50|-> #define FF_OK_TYPE(p,i) (!(p)->types||((p)->decode.bigram1[((i)>>3)&((1<<CHAR_BIT)-1)]&(1<<((i)&07)))) # 51| # 52| typedef struct Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c: scope_hint: In function 'fts_read' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:172:16: warning[-Wanalyzer-malloc-leak]: leak of 'node(fts, *fts.current, s, i)' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:28: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:180:27: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:107:39: note: in definition of macro 'TYPE' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:1024:41: note: in expansion of macro 'D_TYPE' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/dir/dirlib.h:35: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/ast_dir.h:40: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:29: included_from: Included from here. # 170| size_t n; # 171| # 172|-> if (fts->free && namelen < MINNAME) # 173| { # 174| f = fts->free; Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:362: warning[nullPointer]: Possible null pointer dereference: root # 360| for (;;) # 361| { # 362|-> if (root->left) # 363| { # 364| root->stack = stack; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:362:7: warning[core.NullDereference]: Access to field 'left' results in a dereference of a null pointer (loaded from variable 'root') # 360| for (;;) # 361| { # 362|-> if (root->left) # 363| { # 364| root->stack = stack; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c: scope_hint: In function 'getlist' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:362:25: warning[-Wanalyzer-null-dereference]: dereference of NULL 'root' # 360| for (;;) # 361| { # 362|-> if (root->left) # 363| { # 364| root->stack = stack; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:542:12: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 540| f->fts_info = FTS_SL; # 541| } # 542|-> else if (stat(path, &sb) >= 0) # 543| { # 544| *sp = sb; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:867:8: warning[core.NullDereference]: Access to field 'fts_level' results in a dereference of a null pointer (loaded from variable 'f') # 865| */ # 866| # 867|-> if (f->fts_level == 0) # 868| { # 869| fts->parent->fts_number = f->fts_number; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:911:8: warning[core.NullDereference]: Access to field 'fts_info' results in a dereference of a null pointer (loaded from variable 'f') # 909| */ # 910| # 911|-> if (f->fts_info == FTS_D) # 912| { # 913| if ((fts->diroot = search(f, fts->diroot, statcmp, 0)) != f || f->fts_level > 0 && (t = f) && statcmp(&t, &f->fts_parent) == 0) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:953:21: warning[core.NullDereference]: Access to field 'nd' results in a dereference of a null pointer (loaded from variable 'f') # 951| */ # 952| # 953|-> if (!fts->dir || f->nd || f->status == FTS_SKIP) # 954| { # 955| if (fts->dir) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/fts.c:1252:19: warning[core.NullDereference]: Access to field 'fts_namelen' results in a dereference of a null pointer (loaded from variable 'f') # 1250| { # 1251| if (*fts->base) # 1252|-> fts->base += f->fts_namelen; # 1253| if (*(fts->base - 1) != '/') # 1254| *fts->base++ = '/'; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/getcwd.c:56:10: warning[unix.Malloc]: Potential leak of memory pointed to by 'buf' # 54| { # 55| if (!(buf = newof(buf, char, n, 0))) # 56|-> ERROR(ENOMEM); # 57| if (SYSGETCWD(buf, n) >= 0) # 58| { Error: CPPCHECK_WARNING (CWE-562): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/glob.c:666: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 664| gp->gl_lstat = (GL_stat_f)lstat; # 665| if (!gp->gl_intr) # 666|-> gp->gl_intr = &intr; # 667| if (!gp->gl_delim) # 668| gp->gl_delim = '/'; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/glob.c:775:2: warning[deadcode.DeadStores]: Value stored to 'suflen' is never read # 773| else # 774| gp->gl_pat = 0; # 775|-> suflen = 0; # 776| if (!(flags & GLOB_LIST)) # 777| gp->gl_match = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/magic.c:683:9: warning[deadcode.DeadStores]: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' # 681| if (!ep->value.sub) # 682| goto next; # 683|-> if ((c = regexec(ep->value.sub, p, elementsof(matches), matches, 0)) || (c = regsubexec(ep->value.sub, p, elementsof(matches), matches))) # 684| { # 685| c = mp->fbsz; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/magic.c:683:77: warning[deadcode.DeadStores]: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' # 681| if (!ep->value.sub) # 682| goto next; # 683|-> if ((c = regexec(ep->value.sub, p, elementsof(matches), matches, 0)) || (c = regsubexec(ep->value.sub, p, elementsof(matches), matches))) # 684| { # 685| c = mp->fbsz; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/magic.c: scope_hint: In function 'ckenglish' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/magic.c:950:60: warning[-Wchar-subscripts]: array subscript has type 'char' # 950 | vowl += mp->count[toupper(*s)] + mp->count[*s]; # | ^~ # 948| return 0; # 949| for (s = "aeiou"; *s; s++) # 950|-> vowl += mp->count[toupper(*s)] + mp->count[*s]; # 951| for (s = "etaion"; *s; s++) # 952| freq += mp->count[toupper(*s)] + mp->count[*s]; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/magic.c:952:60: warning[-Wchar-subscripts]: array subscript has type 'char' # 952 | freq += mp->count[toupper(*s)] + mp->count[*s]; # | ^~ # 950| vowl += mp->count[toupper(*s)] + mp->count[*s]; # 951| for (s = "etaion"; *s; s++) # 952|-> freq += mp->count[toupper(*s)] + mp->count[*s]; # 953| for (s = "vjkqxz"; *s; s++) # 954| rare += mp->count[toupper(*s)] + mp->count[*s]; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/magic.c:954:60: warning[-Wchar-subscripts]: array subscript has type 'char' # 954 | rare += mp->count[toupper(*s)] + mp->count[*s]; # | ^~ # 952| freq += mp->count[toupper(*s)] + mp->count[*s]; # 953| for (s = "vjkqxz"; *s; s++) # 954|-> rare += mp->count[toupper(*s)] + mp->count[*s]; # 955| return 5 * vowl >= mp->fbsz - mp->count[' '] && freq >= 10 * rare; # 956| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/magic.c:2339:4: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value # 2337| s = type(mp, file, st, mp->tbuf, &mp->tbuf[sizeof(mp->tbuf)-1]); # 2338| if (mp->fp) # 2339|-> sfseek(mp->fp, off, SEEK_SET); # 2340| if (!(mp->flags & (MAGIC_MIME|MAGIC_ALL))) # 2341| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/magic.c:2419:5: warning[core.NullDereference]: Dereference of null pointer # 2417| { # 2418| ep = rp; # 2419|-> ep->value.lab->mask = 1; # 2420| } # 2421| ep = ep->next; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/magic.c: scope_hint: In function 'magiclist' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/magic.c:2421:28: warning[-Wanalyzer-null-dereference]: dereference of NULL 'ep' # 2419| ep->value.lab->mask = 1; # 2420| } # 2421|-> ep = ep->next; # 2422| } # 2423| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:776:7: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value # 774| # 775| for (e = (p = (char*)tab) + num * siz; p < e; p += siz) # 776|-> if (match(s, *((char**)p), -1, NULL, NULL)) # 777| return p; # 778| return NULL; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c: scope_hint: In function 'init' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:909:35: warning[-Wchar-subscripts]: array subscript has type 'char' # 909 | if (!map[OPT_FLAGS[0]]) # 907| setlocale(LC_ALL, ""); # 908| state.xp = sfstropen(); # 909|-> if (!map[OPT_FLAGS[0]]) # 910| for (n = 0, t = OPT_FLAGS; *t; t++) # 911| map[*t] = ++n; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:911:37: warning[-Wchar-subscripts]: array subscript has type 'char' # 911 | map[*t] = ++n; # | ^~ # 909| if (!map[OPT_FLAGS[0]]) # 910| for (n = 0, t = OPT_FLAGS; *t; t++) # 911|-> map[*t] = ++n; # 912| } # 913| #if _BLD_DEBUG Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c: scope_hint: In function 'optget' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:1182:13: warning[-Wanalyzer-malloc-leak]: leak of 'info(psp, next(s, version) + 1, 0, xp, id)' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:5738:17: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4302:24: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:1184:19: note: in expansion of macro 'newof' # 1180| static Push_t push; # 1181| # 1182|-> b = expand(s, e, &s, ip, id); # 1183| n = strlen(b); # 1184| if (tsp = newof(0, Push_t, 1, n + 1)) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:1361:4: warning[unix.Malloc]: Argument to free() is the address of the static variable 'push', which is not memory allocated by malloc() # 1359| e = psp->oe; # 1360| psp = psp->next; # 1361|-> free(tsp); # 1362| continue; # 1363| } Error: COMPILER_WARNING (CWE-126): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c: scope_hint: In function 'args' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:1599:36: warning[-Wstringop-overread]: 'memchr' specified bound [18446744071562067968, 0] exceeds maximum object size 9223372036854775807 # 1599 | t = (char*)memchr(p, '\n', n); # | ^~~~~~~~~~~~~~~~~~ # 1597| for (;;) # 1598| { # 1599|-> t = (char*)memchr(p, '\n', n); # 1600| if (style >= STYLE_man) # 1601| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:2003:5: warning[unix.Malloc]: Argument to free() is the address of the static variable 'push', which is not memory allocated by malloc() # 2001| s = psp->ob; # 2002| psp = psp->next; # 2003|-> free(tsp); # 2004| continue; # 2005| case ']': Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:2013:7: warning[deadcode.DeadStores]: Value stored to 'f' is never read # 2011| { # 2012| sfputr(sp, font(f, style, 0), -1); # 2013|-> f = 0; # 2014| } # 2015| for (;;) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:2135:8: warning[unix.Malloc]: Argument to free() is the address of the static variable 'push', which is not memory allocated by malloc() # 2133| s = psp->ob; # 2134| psp = psp->next; # 2135|-> free(tsp); # 2136| } # 2137| else Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:2916:5: warning[unix.Malloc]: Argument to free() is the address of the static variable 'push', which is not memory allocated by malloc() # 2914| p = psp->ob; # 2915| psp = psp->next; # 2916|-> free(tsp); # 2917| continue; # 2918| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:2981:13: warning[core.CallAndMessage]: 4th function call argument is an uninitialized value # 2979| goto nospace; # 2980| else # 2981|-> p = textout(sp_misc, p, cb, cl, style, 1, 3, sp_info, version, id, catalog, &hflags); # 2982| continue; # 2983| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:3015:11: warning[core.CallAndMessage]: 4th function call argument is an uninitialized value # 3013| if (style >= STYLE_man) # 3014| { # 3015|-> p = textout(sp_body, p, cb, cl, style, 0, 0, sp_info, version, id, catalog, &bflags); # 3016| if (!sp_head) # 3017| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:3963:8: warning[deadcode.DeadStores]: Value stored to 'tp' is never read # 3961| if (p > y + 1) # 3962| { # 3963|-> tp = 0; # 3964| co += p - y - 1; # 3965| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4374:2: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 4372| nov = no = num = 1; # 4373| e = w = v = 0; # 4374|-> n = x = 0; # 4375| for (;;) # 4376| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4495:10: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 4493| else # 4494| no = 0; # 4495|-> for (c = *s; *s; s++) # 4496| { # 4497| if (*s == '=') Error: GCC_ANALYZER_WARNING (CWE-124): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4771:70: warning[-Wanalyzer-out-of-bounds]: buffer underwrite ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:5738:17: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4302:24: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/sfio.h:356:51: note: in expansion of macro '__sf_putc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4768:49: note: in expansion of macro 'sfputc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/sfio.h:356:51: note: in expansion of macro '__sf_putc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4768:49: note: in expansion of macro 'sfputc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/sfio.h:356:51: note: in expansion of macro '__sf_putc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4768:49: note: in expansion of macro 'sfputc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:863:17: note: in expansion of macro 'sfstruse' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4771:70: note: valid subscripts for '"error"' are '[0]' to '[5]' # 4769| s = expand(s + 2, NULL, &t, vp, id); # 4770| if (*s) # 4771|-> *(f = s - 1) = k; # 4772| else # 4773| { Error: GCC_ANALYZER_WARNING (CWE-471): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4771:70: warning[-Wanalyzer-write-to-string-literal]: write to string literal ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:5738:17: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4302:24: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/sfio.h:356:51: note: in expansion of macro '__sf_putc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4768:49: note: in expansion of macro 'sfputc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/sfio.h:356:51: note: in expansion of macro '__sf_putc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4768:49: note: in expansion of macro 'sfputc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/sfio.h:356:51: note: in expansion of macro '__sf_putc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4768:49: note: in expansion of macro 'sfputc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:863:17: note: in expansion of macro 'sfstruse' # 4769| s = expand(s + 2, NULL, &t, vp, id); # 4770| if (*s) # 4771|-> *(f = s - 1) = k; # 4772| else # 4773| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:4927:9: warning[deadcode.DeadStores]: Value stored to 'psp' is never read # 4925| if (!(n = (m || *s == ':' || *s == '|' || *s == '?' || *s == ']' || *s == 0)) && x) # 4926| { # 4927|-> psp = pop(psp); # 4928| return opterror("?", 0, version, id, catalog); # 4929| } Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c: scope_hint: In function 'optget' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:5030:82: warning[-Wchar-subscripts]: array subscript has type 'char' # 5030 | cache->flags[map[*f]] = m; # | ^~ # 5028| break; # 5029| else # 5030|-> cache->flags[map[*f]] = m; # 5031| j = 0; # 5032| /* Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:5149:58: warning[-Wchar-subscripts]: array subscript has type 'char' # 5149 | cache->flags[map[*s]] = m; # | ^~ # 5147| m |= OPT_cache_optional; # 5148| } # 5149|-> cache->flags[map[*s]] = m; # 5150| } # 5151| s++; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:5445:10: warning[deadcode.DeadStores]: Value stored to 'nov' is never read # 5443| if (!*w) # 5444| { # 5445|-> nov = 0; # 5446| break; # 5447| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:5457:10: warning[deadcode.DeadStores]: Value stored to 'num' is never read # 5455| { # 5456| if (n) # 5457|-> num = 0; # 5458| if (!(n = (m || *s == ':' || *s == '|' || *s == '?' || *s == ']')) && x) # 5459| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:5483:9: warning[deadcode.DeadStores]: Value stored to 'a' is never read # 5481| } # 5482| b = e; # 5483|-> a = s = skip(s, 0, 0, 0, 1, 0, 0, version); # 5484| if (n) # 5485| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/optget.c:5567:3: warning[deadcode.DeadStores]: Value stored to 'psp' is never read # 5565| return opterror(v, 0, version, id, catalog); # 5566| } # 5567|-> psp = pop(psp); # 5568| if (argv == state.strv) # 5569| return '#'; Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/procopen.c: scope_hint: In function 'procopen' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/procopen.c:466:12: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'procfd' # 464| #endif /* _use_spawnveg */ # 465| } # 466|-> if (procfd >= 0) # 467| { # 468| #if _pipe_rw Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/procopen.c:466:13: warning[core.UndefinedBinaryOperatorResult]: The left operand of '>=' is a garbage value # 464| #endif /* _use_spawnveg */ # 465| } # 466|-> if (procfd >= 0) # 467| { # 468| #if _pipe_rw Error: GCC_ANALYZER_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/procopen.c:563:41: warning[-Wanalyzer-fd-use-without-check]: 'write' on possibly invalid file descriptor '-1' # 561| { # 562| if (proc->pid > 0) # 563|-> write(pop[1], &proc->pid, sizeof(proc->pid)); # 564| _exit(EXIT_NOEXEC); # 565| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/procopen.c:599:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges # 597| if ((flags & PROC_PRIVELEGED) && !geteuid()) # 598| { # 599|-> setuid(geteuid()); # 600| setgid(getegid()); # 601| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/procopen.c:600:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setgid' is not checked. If an error occurs in 'setgid', the following code may execute with unexpected privileges # 598| { # 599| setuid(geteuid()); # 600|-> setgid(getegid()); # 601| } # 602| if (flags & (PROC_PARANOID|PROC_GID)) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/recstr.c:178:5: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 176| case '0': case '1': case '2': case '3': case '4': # 177| case '5': case '6': case '7': case '8': case '9': # 178|-> v = 0; # 179| a[n++] = strtol(s, &t, 0); # 180| s = (const char*)t - 1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/stk.c:279:19: warning[core.NullDereference]: Access to field 'stkoverflow' results in a dereference of a null pointer (loaded from variable 'sp') # 277| sp = stkcur; # 278| if(oflow) # 279|-> sp->stkoverflow = oflow; # 280| return old; # 281| } Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/stk.c: scope_hint: In function 'stkinstall' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/stk.c:279:33: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sp' # 277| sp = stkcur; # 278| if(oflow) # 279|-> sp->stkoverflow = oflow; # 280| return old; # 281| } Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/translate.c: scope_hint: In function 'match' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/translate.c:249:28: warning[-Wanalyzer-null-dereference]: dereference of NULL 't' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/translate.c:26: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/translate.c:292:1: note: in expansion of macro 'translate' # 247| t = strchr(s, ':'); # 248| } # 249|-> *t = 0; # 250| } # 251| if (*s && ((cp = (Catalog_t*)dtmatch(state.catalogs, s)) || (cp = init(s))) && cp->messages && (mp = (Message_t*)dtmatch(cp->messages, msg))) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/translate.c:423:26: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value # 421| sfprintf(sfstderr, "translate locale=%s catalog=%s set=%d seq=%d \"%s\" => \"%s\"\n", cp->locale, cp->name, mp->set, mp->seq, msg, r == (char*)msg ? "NOPE" : r); # 422| done: # 423|-> if (r == (char*)msg && (!cp && streq(loc, "debug") || cp && cp->debug)) # 424| { # 425| p = tempget(state.tmp); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathcanon.c:70:3: warning[deadcode.DeadStores]: Value stored to 'size' is never read # 68| v = path + ((flags >> 5) & 01777); # 69| if (!size) # 70|-> size = strlen(path) + 1; # 71| if (*path == '/') # 72| { Error: COMPILER_WARNING (CWE-562): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathkey.c: scope_hint: In function 'pathkey_20100601' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathkey.c:283:41: warning[-Wreturn-local-addr]: function may return address of local variable # 283 | return key == buf ? strdup(key) : key; # | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathkey.c:58:25: note: declared here # 58 | char buf[15]; # | ^~~ # 281| *--k = '.'; # 282| } # 283|-> return key == buf ? strdup(key) : key; # 284| } Error: COMPILER_WARNING (CWE-562): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathpath.c: scope_hint: In function 'pathpath_20100601' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathpath.c:124:1: warning[-Wreturn-local-addr]: function may return address of local variable # 124 | } # | ^ ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathpath.c:52:25: note: declared here # 52 | char buf[PATH_MAX]; # | ^~~ ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathpath.c:52:25: note: declared here # 122| s = pathaccess(x, p, a, mode, path, size); # 123| return (s && path == buf) ? strdup(s) : s; # 124|-> } Error: COMPILER_WARNING (CWE-562): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathprobe.c: scope_hint: In function 'pathprobe_20100601' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathprobe.c:322:1: warning[-Wreturn-local-addr]: function may return address of local variable # 322 | } # | ^ ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathprobe.c:113:25: note: declared here # 113 | char buf[PATH_MAX]; # | ^~~ # 320| } # 321| return path == buf ? strdup(path) : path; # 322|-> } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathrepl.c:55:3: warning[deadcode.DeadStores]: Value stored to 'size' is never read # 53| return path + strlen(path); # 54| if (!size) # 55|-> size = strlen(path) + 1; # 56| for (;;) # 57| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathrepl.c:60:16: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'm') # 58| while (*path && *path++ != '/'); # 59| if (!*path) break; # 60|-> if (*path == *m) # 61| { # 62| t = path; Error: GCC_ANALYZER_WARNING (CWE-131): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathtemp.c: scope_hint: In function 'pathtemp' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathtemp.c:229:47: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathtemp.c:69: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathtemp.c:229:49: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/path/pathtemp.c:229:49: note: in expansion of macro 'newof' # 227| n++; # 228| } # 229|-> if (!(tmp.vec = newof(0, char*, n, strlen(x) + 1))) # 230| return NULL; # 231| tmp.dir = tmp.vec; Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/astconf.c: scope_hint: In function 'synthesize.part.0' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/astconf.c:336:20: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/include/ast.h:32: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/misc/univlib.h:41: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/astconf.c:28: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/astconf.c:327:49: note: in expansion of macro 'getenv' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/astconf.c:330:36: note: in expansion of macro 'newof' # 334| state.data += state.prefix - 1; # 335| *state.data++ = '='; # 336|-> if (s) # 337| strcpy(state.data, s); # 338| ve = state.data; Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/astconf.c:747: warning[nullPointer]: Possible null pointer dereference: name # 745| value = null; # 746| if (!fp) # 747|-> for (fp = state.features; fp && !streq(fp->name, name); fp = fp->next); # 748| #if DEBUG_astconf # 749| error(-6, "astconf feature name=%s path=%s value=%s flags=%04x fp=%p%s", name, path, value, flags, fp, state.synthesizing ? " SYNTHESIZING" : ""); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/astconf.c:1292:8: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'name') # 1290| if (!(listflags & ~(ASTCONF_error|ASTCONF_system))) # 1291| for (fp = state.features; fp; fp = fp->next) # 1292|-> if (streq(name, fp->name)) # 1293| return format(fp, path, 0, listflags, conferror); # 1294| return (listflags & ASTCONF_error) ? NULL : null; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/lc.c:351:4: warning[deadcode.DeadStores]: Value stored to 't' is never read # 349| { # 350| *s++ = '.'; # 351|-> t = cp->code; # 352| if (streq(cp->code, "utf8") && (t = _locale_utf8_str)) # 353| for (; s < e && (c = *t++); s++) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/lc.c:561:6: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 559| if (!lp->code) # 560| { # 561|-> c = s[2]; # 562| s[2] = 0; # 563| for (lp = lc_languages; lp->code && !streq(s, lp->code); lp++); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/lc.c:774:10: warning[unix.Malloc]: Potential leak of memory pointed to by 'al' # 772| } # 773| if (!(lc = newof(0, Lc_t, 1, n + z))) # 774|-> return NULL; # 775| strcpy((char*)(lc->name = (const char*)(lc + 1)), name); # 776| lc->code = lc->name + n; Error: GCC_ANALYZER_WARNING (CWE-775): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/lcgen.c: scope_hint: In function 'main' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/lcgen.c:269:12: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(hdr, "w")' # 267| return 1; # 268| } # 269|-> if (!(lf = fopen(lib, "w"))) # 270| { # 271| fprintf(stderr, "%s: %s: cannot write\n", command, lib); Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/lcgen.c:269:12: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(hdr, "w")' # 267| return 1; # 268| } # 269|-> if (!(lf = fopen(lib, "w"))) # 270| { # 271| fprintf(stderr, "%s: %s: cannot write\n", command, lib); Error: CPPCHECK_WARNING (CWE-404): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/lcgen.c:272: error[resourceLeak]: Resource leak: hf # 270| { # 271| fprintf(stderr, "%s: %s: cannot write\n", command, lib); # 272|-> return 1; # 273| } # 274| type = 0; Error: GCC_ANALYZER_WARNING (CWE-775): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/lcgen.c:306:20: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(hdr, "w")' # 304| fprintf(lf, "#include \"lclang.h\"\n"); # 305| fprintf(lf, "\n"); # 306|-> while (s = fgets(buf, sizeof(buf), stdin)) # 307| { # 308| line++; Error: GCC_ANALYZER_WARNING (CWE-775): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/lcgen.c:306:20: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(lib, "w")' # 304| fprintf(lf, "#include \"lclang.h\"\n"); # 305| fprintf(lf, "\n"); # 306|-> while (s = fgets(buf, sizeof(buf), stdin)) # 307| { # 308| line++; Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/lcgen.c:306:20: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(hdr, "w")' # 304| fprintf(lf, "#include \"lclang.h\"\n"); # 305| fprintf(lf, "\n"); # 306|-> while (s = fgets(buf, sizeof(buf), stdin)) # 307| { # 308| line++; Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/lcgen.c:306:20: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(lib, "w")' # 304| fprintf(lf, "#include \"lclang.h\"\n"); # 305| fprintf(lf, "\n"); # 306|-> while (s = fgets(buf, sizeof(buf), stdin)) # 307| { # 308| line++; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/mc.c: scope_hint: In function 'mcindex' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/port/mc.c:625:41: warning[-Wchar-subscripts]: array subscript has type 'char' # 625 | for (n = m = 0; (c = cv[*s]) < 36; s++) # | ^~ # 623| SFCVINIT(); # 624| cv = _Sfcv36; # 625|-> for (n = m = 0; (c = cv[*s]) < 36; s++) # 626| { # 627| m++; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regcomp.c:1315:13: warning[deadcode.DeadStores]: Although the value stored to 'i' is used in the enclosing expression, the value is never actually read from 'i' # 1313| if (*s == ':' && *(s + 1) == ']' && *(s + 2) == ']') # 1314| { # 1315|-> if ((i = (s - start)) == 1) # 1316| { # 1317| switch (c) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regcomp.c:1364:5: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 1362| else # 1363| setadd(e->re.charclass, buf[0]); # 1364|-> c = buf[0]; # 1365| inrange = 0; # 1366| complicated++; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regcomp.c:1669:7: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 1667| } # 1668| inrange = 0; # 1669|-> c = *pp; # 1670| continue; # 1671| case '.': Error: CPPCHECK_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regcomp.c:1937: warning[uninitvar]: Uninitialized variable: *s # 1935| return 1; # 1936| } # 1937|-> if (!(t = g->re.trie.root[*s]) && !(t = g->re.trie.root[*s] = trienode(env, *s))) # 1938| return 1; # 1939| for (len = 1;;) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regcomp.c:2304:13: warning[deadcode.DeadStores]: Although the value stored to 'i' is used in the enclosing expression, the value is never actually read from 'i' # 2302| goto quote; # 2303| case 'O': # 2304|-> switch (i = chr(env, &esc)) # 2305| { # 2306| case 'T': Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regexec.c:38: warning[nullPointer]: Possible null pointer dereference: match # 36| { # 37| int r; # 38|-> int m = match->rm_so; # 39| regmatch_t* e; # 40| Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regexec.c:38:3: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 36| { # 37| int r; # 38|-> int m = match->rm_so; # 39| regmatch_t* e; # 40| Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regexec.c:38:12: warning[core.NullDereference]: Access to field 'rm_so' results in a dereference of a null pointer (loaded from variable 'match') # 36| { # 37| int r; # 38|-> int m = match->rm_so; # 39| regmatch_t* e; # 40| Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regexec.c: scope_hint: In function 'regexec_20120528.part.0' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regexec.c:38:42: warning[-Wanalyzer-null-dereference]: dereference of NULL 'match' # 36| { # 37| int r; # 38|-> int m = match->rm_so; # 39| regmatch_t* e; # 40| Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regexec.c:38:42: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*match.rm_so' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/reglib.h:56: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regexec.c:26: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regexec.c:71:31: note: in expansion of macro 'oldof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regexec.c:71:31: note: in expansion of macro 'oldof' # 36| { # 37| int r; # 38|-> int m = match->rm_so; # 39| regmatch_t* e; # 40| Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regexec.c:41: warning[nullPointer]: Possible null pointer dereference: match # 39| regmatch_t* e; # 40| # 41|-> if (!(r = regnexec(p, s + m, match->rm_eo - m, nmatch, match, flags)) && m > 0) # 42| for (e = match + nmatch; match < e; match++) # 43| if (match->rm_so >= 0) Error: COMPILER_WARNING (CWE-697): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regnexec.c: scope_hint: In function 'parse' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regnexec.c:1063:29: warning[-Waddress]: the comparison will always evaluate as 'true' for the pointer operand in 'env->bestpos->vec + (sizetype)(n * (ssize_t)env->bestpos->siz)' must not be NULL # 1063 | if (!vector(Pos_t, env->bestpos, n)) # | ^ # 1061| memcpy(&env->best[1], &env->match[1], r * sizeof(regmatch_t)); # 1062| n = env->pos->cur; # 1063|-> if (!vector(Pos_t, env->bestpos, n)) # 1064| { # 1065| env->error = REG_ESPACE; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regnexec.c:1275:10: warning[core.UndefinedBinaryOperatorResult]: The left operand of '==' is a garbage value # 1273| env->end = e; # 1274| } # 1275|-> if (r == NONE) # 1276| r = follow(env, rex, cont, s); # 1277| else if (r != BAD) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regnexec.c:2007:11: warning[core.UndefinedBinaryOperatorResult]: The right operand of '>' is a garbage value # 2005| if (!i || !k || (i & 1)) # 2006| { # 2007|-> if (i > n) # 2008| match[j] = state.nomatch; # 2009| else Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regrexec.c:168:23: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 166| for (i = 0; i < nmatch; i++) # 167| { # 168|-> oldmatch[i].rm_so = match[i].rm_so; # 169| oldmatch[i].rm_eo = match[i].rm_eo; # 170| } Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regrexec.c: scope_hint: In function 'regrexec' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regrexec.c:168:61: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*<unknown>.rm_so' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/reglib.h:56: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regrexec.c:26: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regrexec.c:163:31: note: in expansion of macro 'oldof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regrexec.c:163:31: note: in expansion of macro 'oldof' # 166| for (i = 0; i < nmatch; i++) # 167| { # 168|-> oldmatch[i].rm_so = match[i].rm_so; # 169| oldmatch[i].rm_eo = match[i].rm_eo; # 170| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regstat.c:47:44: warning[core.NullDereference]: Access to field 'type' results in a dereference of a null pointer (loaded from field 'rex') # 45| if (!e || e->type == REX_END && !e->next) # 46| p->env->stats.re_info |= REG_LITERAL; # 47|-> p->env->stats.re_record = (p && p->env && p->env->rex->type == REX_BM) ? p->env->rex->re.bm.size : -1; # 48| return &p->env->stats; # 49| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regsubcomp.c:184:6: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 182| if (n = regsubflags(p, s, &e, d, map, &minmatch, &flags)) # 183| return n; # 184|-> s = (const char*)e; # 185| } # 186| p->re_npat = s - o; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/regex/regsubcomp.c:342:70: warning[deadcode.DeadStores]: Although the value stored to 'nops' is used in the enclosing expression, the value is never actually read from 'nops' # 340| if ((op->len = (t - sub->re_rhs) - op->off) && (n = ++op - sub->re_ops) >= nops) # 341| { # 342|-> if (!(sub->re_ops = (regsubop_t*)alloc(p->env->disc, sub->re_ops, (nops *= 2) * sizeof(regsubop_t)))) # 343| { # 344| regfree(p); Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/_sfputd.c: scope_hint: In function '_sfputd' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/_sfputd.c:76:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'c[255]' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/_sfputd.c:19: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/_sfputd.c:58:9: note: in expansion of macro 'SFOPEN' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/_sfputd.c:61:9: note: in expansion of macro 'SFLOCK' # 74| /* last byte is not SF_MORE */ # 75| ends = &c[0] + sizeof(c) -1; # 76|-> *ends &= ~SF_MORE; # 77| # 78| /* write out coded bytes */ Error: CPPCHECK_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfcvt.c: error[internalError]: Internal Error. MathLib::toDoubleNumber: conversion failed: 1.18973149535723176502126385303097021e+4932L Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfcvt.c:142:7: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 140| } # 141| #if _lib_isinf # 142|-> if (n = isinf(f)) # 143| { # 144| #if _lib_signbit Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfcvt.c:292:7: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 290| } # 291| #if _lib_isinf # 292|-> if (n = isinf(f)) # 293| { # 294| #if _lib_signbit Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sffilbuf.c:97:7: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 95| f->mode |= rcrv; # 96| f->getr = rc; # 97|-> if((r = SFRD(f,f->endb,r,f->disc)) >= 0) # 98| { r = f->endb - f->next; # 99| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfgetr.c:139:13: warning[core.NullDereference]: Array access (from variable 'us') results in a null pointer dereference # 137| f->getr = 0; # 138| if(found && rc != 0 && (type&SF_STRING) ) # 139|-> { us[un-1] = '\0'; # 140| if(us >= f->data && us < f->endb) # 141| { f->getr = rc; Error: GCC_ANALYZER_WARNING (CWE-1341): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfmode.c:20: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfmode.c: scope_hint: In function '_sfpclose' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfhdr.h:476:33: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor '*p.file' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfmode.c:221:25: note: in expansion of macro 'CLOSE' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfmode.c:221:25: note: in expansion of macro 'CLOSE' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfmode.c:221:25: note: in expansion of macro 'CLOSE' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfmode.c:221:25: note: in expansion of macro 'CLOSE' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfmode.c:221:25: note: in expansion of macro 'CLOSE' # 474| # 475| /* safe closing function */ # 476|-> #define CLOSE(f) { while(close(f) < 0 && errno == EINTR) errno = 0; } # 477| # 478| /* the bottomless bit bucket */ Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfmode.c:64:2: warning[deadcode.DeadStores]: Value stored to 'f' is never read # 62| int pool; # 63| # 64|-> f = (Sfio_t*)Version; /* shut compiler warning */ # 65| # 66| /* set this so that no more buffering is allowed for write streams */ Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfmode.c:350:3: warning[core.CallAndMessage]: Called function pointer is null (null dereference) # 348| # 349| if(f->mode&SF_STDIO) /* synchronizing with stdio pointers */ # 350|-> (*_Sfstdsync)(f); # 351| # 352| if(f->disc == _Sfudisc && wanted == SF_WRITE && Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfpkrd.c:171:6: warning[deadcode.DeadStores]: Value stored to 't' is never read # 169| } # 170| if(r >= 0) # 171|-> { t &= ~STREAM_PEEK; # 172| if(r > 0) # 173| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfrd.c:198:6: warning[deadcode.DeadStores]: Value stored to 'r' is never read # 196| } # 197| else # 198|-> { r = -1; # 199| f->here += a; # 200| Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfreserve.c:96:11: warning[deadcode.DeadStores]: Although the value stored to 'now' is used in the enclosing expression, the value is never actually read from 'now' # 94| SFLOCK(f,local); # 95| # 96|-> if((n = now = f->endb - f->next) < 0) # 97| n = 0; # 98| if(n > 0 && n >= sz) /* all done */ Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/strtod.c:28: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfstrtof.h:337:4: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 335| ((c = GET(s)) == 'y' || c == 'Y')) # 336| { # 337|-> c = GET(s); # 338| SET(s, t, b); # 339| } Error: CPPCHECK_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sftable.c: error[internalError]: Internal Error. MathLib::toDoubleNumber: conversion failed: 1E309L Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sftable.c:57:35: warning[deadcode.DeadStores]: Value stored to 'argn' is never read # 55| return NULL; # 56| # 57|-> dollar = decimal = thousand = 0; argn = maxp = -1; # 58| nargs = xargs = -1; # 59| SFMBCLR(&fmbs); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sftable.c:57:42: warning[deadcode.DeadStores]: Although the value stored to 'maxp' is used in the enclosing expression, the value is never actually read from 'maxp' # 55| return NULL; # 56| # 57|-> dollar = decimal = thousand = 0; argn = maxp = -1; # 58| nargs = xargs = -1; # 59| SFMBCLR(&fmbs); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sftable.c:62:5: warning[deadcode.DeadStores]: Value stored to 'sp' is never read # 60| while((n = *form) ) # 61| { if(n != '%') /* collect the non-pattern chars */ # 62|-> { sp = (char*)form; # 63| for(;;) # 64| { form += SFMBLEN(form, &fmbs); Error: GCC_ANALYZER_WARNING (CWE-404): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c: scope_hint: In function 'sfvprintf' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:154:24: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:213:25: note: in expansion of macro 'SFputc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:119:43: note: in expansion of macro 'SFBUF' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:140:55: note: in expansion of macro 'SMputc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:213:25: note: in expansion of macro 'SFputc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:1415:9: note: in expansion of macro 'SFEND' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:22: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfhdr.h:520:71: note: in expansion of macro '_SFOPEN' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:1427:9: note: in expansion of macro 'SFOPEN' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfhdr.h:516:50: note: in expansion of macro '_SFOPENRD' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfhdr.h:520:71: note: in expansion of macro '_SFOPEN' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:1427:9: note: in expansion of macro 'SFOPEN' # 152| # 153| if(!f || !form) # 154|-> return -1; # 155| # 156| /* make sure stream is in write mode and buffer is not NULL */ Error: CPPCHECK_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:164: error[uninitvar]: Uninitialized variable: f->data # 162| if(!f->data && !(f->flags&SF_STRING)) # 163| { f->data = f->next = (uchar*)data; # 164|-> f->endb = f->data+sizeof(data); # 165| } # 166| SFINIT(f); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:364:5: warning[deadcode.DeadStores]: Value stored to 'fmt' is never read # 362| if((*ft->extf)(f, &argv, ft) < 0) # 363| goto pop_fmt; # 364|-> fmt = ft->fmt; # 365| flags = (flags&~SFFMT_TYPES) | (ft->flags&SFFMT_TYPES); # 366| if(ft->flags&SFFMT_VALUE) Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:553: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 551| { if(size == sizeof(short)) # 552| { if(_Sftype[fmt]&SFFMT_INT) # 553|-> argv.i = argv.h; # 554| else argv.i = argv.uh; # 555| } Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:554: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 552| { if(_Sftype[fmt]&SFFMT_INT) # 553| argv.i = argv.h; # 554|-> else argv.i = argv.uh; # 555| } # 556| else if(size == sizeof(char)) Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:558: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 556| else if(size == sizeof(char)) # 557| { if(_Sftype[fmt]&SFFMT_INT) # 558|-> argv.i = argv.c; # 559| else argv.i = argv.uc; # 560| } Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:559: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 557| { if(_Sftype[fmt]&SFFMT_INT) # 558| argv.i = argv.c; # 559|-> else argv.i = argv.uc; # 560| } # 561| } Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:564: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 562| else if(_Sftype[fmt]&SFFMT_FLOAT ) # 563| { if(size == sizeof(float) ) # 564|-> argv.d = argv.f; # 565| } # 566| else if(_Sftype[fmt]&SFFMT_CHAR) Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:568: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 566| else if(_Sftype[fmt]&SFFMT_CHAR) # 567| { if(base < 0) # 568|-> argv.i = (int)argv.c; # 569| } # 570| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:626:7: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value # 624| else goto pop_fmt; # 625| # 626|-> if(!argv.ft) # 627| goto pop_fmt; # 628| if(!argv.ft->form && ft ) /* change extension functions */ Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:677:14: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 675| } # 676| else # 677|-> { if(!(sp = argv.s)) # 678| { sp = "(null)"; # 679| flags &= ~SFFMT_LONG; Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:847: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 845| } # 846| else # 847|-> { argv.c = (char)(argv.i); # 848| sp = &argv.c; # 849| size = 1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:847:14: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 845| } # 846| else # 847|-> { argv.c = (char)(argv.i); # 848| sp = &argv.c; # 849| size = 1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:858:16: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value # 856| if(flags&SFFMT_LONG) # 857| { SFMBCLR(&mbs); # 858|-> if((n_s = wcrtomb(buf, *wsp++, &mbs)) <= 0) # 859| break; # 860| if(wc) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:870:60: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*sp' # 868| #endif # 869| if(flags&SFFMT_ALTER) # 870|-> { n_s = chr2str(buf, *sp++); # 871| n = width - precis*n_s; # 872| } Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:874:47: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*sp' # 872| } # 873| else # 874|-> { fmt = *sp++; # 875| n = width - precis; # 876| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:921:23: warning[core.NullDereference]: Dereference of undefined pointer value # 919| #endif # 920| if(size == sizeof(long)) # 921|-> *((long*)argv.vp) = (long)n_output; # 922| else if(size == sizeof(short) ) # 923| *((short*)argv.vp) = (short)n_output; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:926:26: warning[core.NullDereference]: Dereference of undefined pointer value # 924| else if(size == sizeof(uchar) ) # 925| *((uchar*)argv.vp) = (uchar)n_output; # 926|-> else *((int*)argv.vp) = (int)n_output; # 927| # 928| continue; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:935:7: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 933| flags = (flags&~(SFFMT_SIGN|SFFMT_BLANK|SFFMT_ZERO))|SFFMT_ALTER; # 934| #if _more_void_int # 935|-> lv = (Sflong_t)((Sfulong_t)argv.vp); # 936| goto long_cvt; # 937| #else Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:1046:8: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 1044| } # 1045| else # 1046|-> { v = argv.i; # 1047| int_cvt: # 1048| if(scale) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvprintf.c:1154:10: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 1152| { v = 0; # 1153| valp = &argv.d; # 1154|-> dval = argv.d; # 1155| } # 1156| Error: CPPCHECK_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c: error[internalError]: Internal Error. MathLib::toDoubleNumber: conversion failed: 1.18973149535723176502126385303097021e+4932L Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c: scope_hint: In function '_sfsetclass' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:136:24: warning[-Wchar-subscripts]: array subscript has type 'char' # 136 | { ac->ok[*form] = ac->yes; # | ^~~~~ # 134| # 135| if(*form == ']' || *form == '-') /* special first char */ # 136|-> { ac->ok[*form] = ac->yes; # 137| form += 1; # 138| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:181:6: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 179| # 180| SFMBCLR(&mbs); # 181|-> for(n = 1; *form != ']'; form += n) # 182| { if((c = *((uchar*)form)) == 0) # 183| return 0; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c: scope_hint: In function '_sfgetwc' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:248:55: warning[-Wchar-subscripts]: array subscript has type 'char' # 248 | { if((n == 1 && ac->ok[b[0]]) || # | ~^~~ # 246| } # 247| else if(fmt == '[') # 248|-> { if((n == 1 && ac->ok[b[0]]) || # 249| (n > 1 && _sfwaccept(*wc,ac)) ) # 250| return 1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:360:6: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 358| SCinit(&scd,0); SFMBCLR(&mbs); # 359| v = SFgetwc(&scd, &wc, '1', &acc, &mbs); # 360|-> SCend(&scd,0); # 361| if(v == 0) # 362| goto pop_fmt; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:729:24: warning[core.NullDereference]: Dereference of null pointer # 727| else if(size == sizeof(uchar)) # 728| *((uchar*)value) = (uchar)(n_input+SFlen(f)); # 729|-> else *((int*)value) = (int)(n_input+SFlen(f)); # 730| continue; # 731| } Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c: scope_hint: In function 'sfvscanf' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:729:48: warning[-Wanalyzer-null-dereference]: dereference of NULL 'value' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:307:73: note: in expansion of macro 'SFbuf' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:321:9: note: in expansion of macro 'SFinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:307:73: note: in expansion of macro 'SFbuf' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:321:9: note: in expansion of macro 'SFinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:20: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:632:24: note: in expansion of macro 'FP_SET' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:632:24: note: in expansion of macro 'FP_SET' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/sfio/sfvscanf.c:729:64: note: in expansion of macro 'SFlen' # 727| else if(size == sizeof(uchar)) # 728| *((uchar*)value) = (uchar)(n_input+SFlen(f)); # 729|-> else *((int*)value) = (int)(n_input+SFlen(f)); # 730| continue; # 731| } Error: CPPCHECK_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/stdio/getdelim.c:62: error[memleakOnRealloc]: Common realloc mistake: 's' nulled but not freed upon failure # 60| if((m+k+1) >= n ) /* make sure there is space */ # 61| { n = ((m+k+15)/8)*8; # 62|-> if(!(s = (uchar*)realloc(s, n)) ) # 63| { *sp = 0; *np = 0; # 64| m = -1; Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/string/chresc.c:100: error[nullPointer]: Null pointer dereference: 1==(1)?(unsigned char*)0:_ccmap(1,1) # 98| if (islower(c)) # 99| c = toupper(c); # 100|-> c = ccmapc(c, CC_NATIVE, CC_ASCII); # 101| c ^= 0x40; # 102| c = ccmapc(c, CC_ASCII, CC_NATIVE); Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/string/chresc.c:102: error[nullPointer]: Null pointer dereference: 1==(1)?(unsigned char*)0:_ccmap(1,1) # 100| c = ccmapc(c, CC_NATIVE, CC_ASCII); # 101| c ^= 0x40; # 102|-> c = ccmapc(c, CC_ASCII, CC_NATIVE); # 103| } # 104| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/string/strerror.c:100:17: warning[deadcode.DeadStores]: Although the value stored to 'z' is used in the enclosing expression, the value is never actually read from 'z' # 98| else # 99| { # 100|-> t = fmtbuf(z = strlen(s) + 1); # 101| strcpy(t, s); # 102| ast.locale.set |= AST_LC_internal; Error: CPPCHECK_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/string/strntold.c: error[internalError]: Internal Error. MathLib::toDoubleNumber: conversion failed: 1.18973149535723176502126385303097021e+4932L Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/string/strperm.c:61:3: warning[deadcode.DeadStores]: Value stored to 'op' is never read # 59| for (;;) # 60| { # 61|-> op = num = who = typ = 0; # 62| for (;;) # 63| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/comp/strtol.c:29: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/string/strtoi.h:332:5: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 330| s = p; # 331| n = v; # 332|-> c = 0; # 333| break; # 334| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/string/strtoi.h:400:3: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 398| } # 399| } # 400|-> c = *(s - 1); # 401| } # 402| Error: CPPCHECK_WARNING (CWE-664): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/string/tokscan.c:203: error[va_list_usedBeforeStarted]: va_list 'prv_ap' used before va_start() was called. # 201| prv_f = 0; # 202| /* prv_ap value is guarded by prv_f */ # 203|-> va_copy(ap, prv_ap); # 204| continue; # 205| } Error: CPPCHECK_WARNING (CWE-664): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/string/tokscan.c:203: error[va_start_subsequentCalls]: va_start() or va_copy() called subsequently on 'ap' without va_end() in between. # 201| prv_f = 0; # 202| /* prv_ap value is guarded by prv_f */ # 203|-> va_copy(ap, prv_ap); # 204| continue; # 205| } Error: GCC_ANALYZER_WARNING (CWE-404): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/string/tokscan.c: scope_hint: In function 'tokscan' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/string/tokscan.c:244:25: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end' # 242| } # 243| #else # 244|-> va_copy(ap, va_listval(va_arg(ap, va_listarg))); # 245| #endif # 246| continue; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tminit.c:101:15: warning[core.NullDereference]: Array access (from variable 'environ') results in a null pointer dereference # 99| environ = v; # 100| else # 101|-> environ[0] = e; # 102| } # 103| return r; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tminit.c:101:15: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 99| environ = v; # 100| else # 101|-> environ[0] = e; # 102| } # 103| return r; Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tminit.c: scope_hint: In function '_tm_localtime' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tminit.c:101:36: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'e' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tminit.c:32: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tminit.c:146:14: note: in expansion of macro 'tmlocaltime' # 99| environ = v; # 100| else # 101|-> environ[0] = e; # 102| } # 103| return r; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tminit.c:239:12: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value # 237| if (environ != v) # 238| environ = v; # 239|-> else if (e) # 240| environ[0] = e; # 241| } Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tminit.c: scope_hint: In function 'tmlocal' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tminit.c:239:25: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'e' # 237| if (environ != v) # 238| environ = v; # 239|-> else if (e) # 240| environ[0] = e; # 241| } Error: CPPCHECK_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tminit.c:342: error[uninitvar]: Uninitialized variable: buf # 340| tmpoff(s, e - s, tm_info.format[TM_DT], m, TM_DST); # 341| } # 342|-> s = strdup(buf); # 343| } # 344| if (!local.daylight) Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c: scope_hint: In function 'tmxdate' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:255:40: warning[-Wchar-subscripts]: array subscript has type 'char' # 255 | else if (!skip[*s]) # | ^~ # 253| } # 254| } # 255|-> else if (!skip[*s]) # 256| break; # 257| s++; Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c: scope_hint: In function 'tmxdate' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:726:65: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'k' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:32: included_from: Included from here. # 724| else if (*t != '-') # 725| k = 1; # 726|-> else if (*++t && dig1(t, k) < 1 || k > 7) # 727| break; # 728| if (n < 0 || n > 53) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:770:5: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 768| goto save_yymmdd; # 769| } # 770|-> n = strtol(s = t, &t, 0); # 771| if ((t - s) < 2) # 772| break; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:779:6: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 777| if ((t - s) == 1 || *t++ != '-') # 778| break; # 779|-> n = strtol(s = t, &t, 0); # 780| if ((t - s) < 2) # 781| break; Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:812:44: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'k' # 810| message((-1, "AHA#%d n=%d", __LINE__, n)); # 811| ordinal: # 812|-> if (n && k != TM_PARTS) # 813| n--; /* Not for TM_PARTS on par with gdate(1) */ # 814| message((-1, "AHA#%d n=%d", __LINE__, n)); Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:818:50: warning[-Wchar-subscripts]: array subscript has type 'char' # 818 | for (s = t; skip[*s]; s++); # | ^~ # 816| set &= ~(EXACT|LAST|NEXT|THIS); # 817| set |= state & (EXACT|LAST|NEXT|THIS); # 818|-> for (s = t; skip[*s]; s++); # 819| if (isdigit(*s)) # 820| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:887:10: warning[deadcode.DeadStores]: Value stored to 'i' is never read # 885| { # 886| u -= 4; # 887|-> i -= 4; # 888| x = s + 8; # 889| dig4(x, m); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:905:10: warning[deadcode.DeadStores]: Value stored to 'i' is never read # 903| { # 904| u -= 2; # 905|-> i -= 2; # 906| x = s + 8; # 907| dig2(x, m); Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:963:61: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'k' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:773:37: note: in expansion of macro 'dig2' # 961| tm->tm_nsec = p; # 962| save_yymmdd: # 963|-> tm->tm_mday = k; # 964| save_yymm: # 965| tm->tm_mon = l - 1; Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:977:58: warning[-Wchar-subscripts]: array subscript has type 'char' # 977 | for (s = t; skip[*s]; s++) # | ^~ # 975| continue; # 976| } # 977|-> for (s = t; skip[*s]; s++) # 978| ; # 979| message((-1, "AHA#%d s=\"%s\"", __LINE__, s)); Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1089:39: warning[-Wchar-subscripts]: array subscript has type 'char' # 1089 | else if (skip[*s]) # | ^~ # 1087| if (*s == '-' || *s == '+') # 1088| break; # 1089|-> else if (skip[*s]) # 1090| s++; # 1091| else Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1224:7: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 1222| set &= ~(EXACT|LAST|NEXT|THIS); # 1223| set |= state & (EXACT|LAST|NEXT|THIS); # 1224|-> n = 0; # 1225| continue; # 1226| case TM_NEXT: Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1265:61: warning[-Wchar-subscripts]: array subscript has type 'char' # 1265 | while (skip[*u]) # | ^~ # 1263| /* look ahead for TM_PARTS, in k used in ordinal: */ # 1264| u = t; # 1265|-> while (skip[*u]) # 1266| u++; # 1267| k = tmlex(u, &u, Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1275:8: warning[deadcode.DeadStores]: Value stored to 'f' is never read # 1273| f++; # 1274| else if (state & LAST) # 1275|-> f = -1; # 1276| else if (state & THIS) # 1277| f = 1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1277:8: warning[deadcode.DeadStores]: Value stored to 'f' is never read # 1275| f = -1; # 1276| else if (state & THIS) # 1277|-> f = 1; # 1278| else if (state & NEXT) # 1279| f = 2; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1279:8: warning[deadcode.DeadStores]: Value stored to 'f' is never read # 1277| f = 1; # 1278| else if (state & NEXT) # 1279|-> f = 2; # 1280| else # 1281| f = 0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1281:8: warning[deadcode.DeadStores]: Value stored to 'f' is never read # 1279| f = 2; # 1280| else # 1281|-> f = 0; # 1282| if (n > 0) # 1283| { Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1314:69: warning[-Wchar-subscripts]: array subscript has type 'char' # 1314 | while (skip[*u]) # | ^~ # 1312| /* look ahead for TM_PARTS, k used in ordinal: */ # 1313| u = t; # 1314|-> while (skip[*u]) # 1315| u++; # 1316| k = tmlex(u, &u, Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1329:69: warning[-Wchar-subscripts]: array subscript has type 'char' # 1329 | while (skip[*s]) # | ^~ # 1327| for (;;) # 1328| { # 1329|-> while (skip[*s]) # 1330| s++; # 1331| if ((k = tmlex(s, &t, tm_info.format + TM_LAST, TM_NOISE - TM_LAST, NULL, 0)) >= 0) Error: COMPILER_WARNING (CWE-823): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1539:69: warning[-Wchar-subscripts]: array subscript has type 'char' # 1539 | while (skip[*s]) # | ^~ # 1537| if (n < 0) # 1538| { # 1539|-> while (skip[*s]) # 1540| s++; # 1541| if (isdigit(*s)) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1674:32: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'w' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/src/lib/libast/tmx.h:10: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:31: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1203:73: note: in expansion of macro 'tm_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1205:37: note: in expansion of macro 'tm_data' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxdate.c:1269:57: note: in expansion of macro 'tm_info' # 1672| } # 1673| } # 1674|-> if (n < 0 || w > 4) # 1675| break; # 1676| if (w == 4) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tmxmake.c:103:2: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 101| tm->tm_nsec = tmxnsec(t); # 102| tmfix(tm); # 103|-> n += 1900; # 104| tm->tm_isdst = 0; # 105| if (tm->tm_zone->daylight) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tvtouch.c:194:16: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 192| if (av == TV_TOUCH_RETAIN) # 193| { # 194|-> am[0].tv_sec = st.st_atime; # 195| am[0].tv_usec = ST_ATIME_NSEC_GET(&st) / 1000; # 196| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/tm/tvtouch.c:204:16: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 202| if (mv == TV_TOUCH_RETAIN) # 203| { # 204|-> am[1].tv_sec = st.st_mtime; # 205| am[1].tv_usec = ST_MTIME_NSEC_GET(&st) / 1000; # 206| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/malloc.c:934:75: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value # 932| *next = '\0'; # 933| file = buf; # 934|-> if (*file == '&' && *(file += 1) || strncmp(file, "/dev/fd/", 8) == 0 && *(file += 8)) # 935| fd = dup((int)atou(&file)); # 936| else if (*file) Error: CPPCHECK_WARNING (CWE-672): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmbest.c:1183: error[deallocret]: Returning/dereferencing 'caddr' after it is deallocated / released # 1181| else if(nsize == 0) # 1182| { free(caddr); # 1183|-> return caddr; # 1184| } # 1185| else return NULL; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmbest.c:1183:3: warning[unix.Malloc]: Use of memory after it is freed # 1181| else if(nsize == 0) # 1182| { free(caddr); # 1183|-> return caddr; # 1184| } # 1185| else return NULL; Error: COMPILER_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmbest.c: scope_hint: In function 'mallocmem' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmbest.c:1183:24: warning[-Wuse-after-free]: pointer 'caddr_7(D)' used after 'free' # 1183 | return caddr; # | ^~~~~ ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmbest.c:1182:17: note: call to 'free' here # 1182 | { free(caddr); # | ^~~~~~~~~~~ # 1181| else if(nsize == 0) # 1182| { free(caddr); # 1183|-> return caddr; # 1184| } # 1185| else return NULL; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmlast.c:337:11: warning[core.NullDereference]: Access to field 'baddr' results in a dereference of a null pointer (loaded from variable 'seg') # 335| /* free the unused tail */ # 336| next = (Block_t*)(data+size); # 337|-> if((s = (seg->baddr - (Vmuchar_t*)next)) >= sizeof(Block_t)) # 338| { SEG(next) = seg; # 339| SIZE(next) = s - sizeof(Head_t); Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmlast.c: scope_hint: In function 'lastalign' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmlast.c:337:21: warning[-Wanalyzer-null-dereference]: dereference of NULL 'seg' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmlast.c:21: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmlast.c:316:9: note: in expansion of macro 'SETLOCK' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmhdr.h:152:42: note: in definition of macro 'KPVALLOC' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmlast.c:36:9: note: in expansion of macro 'SETLOCK' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmhdr.h:152:42: note: in definition of macro 'KPVALLOC' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmlast.c:332:26: note: in expansion of macro 'VLONG' # 335| /* free the unused tail */ # 336| next = (Block_t*)(data+size); # 337|-> if((s = (seg->baddr - (Vmuchar_t*)next)) >= sizeof(Block_t)) # 338| { SEG(next) = seg; # 339| SIZE(next) = s - sizeof(Head_t); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmopen.c:74:2: warning[deadcode.DeadStores]: Value stored to 'size' is never read # 72| vmp->disc = disc; # 73| # 74|-> size = 0; # 75| # 76| if(disc->exceptf) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmprivate.c:38:13: warning[deadcode.DeadStores]: Value stored to 'addr' during its initialization is never read # 36| Seg_t* seg; # 37| Block_t *bp, *tp, *np; # 38|-> Vmuchar_t* addr = (Vmuchar_t*)Version; /* shut compiler warning */ # 39| Vmdata_t* vd = vm->data; # 40| Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmprofile.c:227: error[ctunullpointer]: Null pointer dereference: pf # 225| int cmp; # 226| # 227|-> if(!pf->next) # 228| return pf; # 229| Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmprofile.c:227: warning[nullPointer]: Possible null pointer dereference: pf # 225| int cmp; # 226| # 227|-> if(!pf->next) # 228| return pf; # 229| Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmprofile.c: scope_hint: In function 'pfsort' ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmprofile.c:227:15: warning[-Wanalyzer-null-dereference]: dereference of NULL 'pf' # 225| int cmp; # 226| # 227|-> if(!pf->next) # 228| return pf; # 229| Error: GCC_ANALYZER_WARNING (CWE-465): ksh-1.0.8-build/ksh-1.0.8/src/lib/libast/vmalloc/vmprofile.c:232:15: warning[-Wanalyzer-deref-before-check]: check of 'pf' for NULL after already dereferencing it # 230| /* partition to two equal size lists */ # 231| one = two = NULL; # 232|-> while(pf) # 233| { next = pf->next; # 234| pf->next = one; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cat.c:143:9: warning[deadcode.DeadStores]: Although the value stored to 'buf' is used in the enclosing expression, the value is never actually read from 'buf' # 141| meta[0] = 'M'; # 142| last = -1; # 143|-> *(cp = buf = end = tmp) = 0; # 144| any = 0; # 145| header = flags & (B_FLAG|N_FLAG); Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cat.c:153:17: warning[core.uninitialized.ArraySubscript]: Array subscript is undefined # 151| cur = cp; # 152| if (raw) # 153|-> while (!(n = states[*cp++])); # 154| else # 155| for (;;) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c: scope_hint: In function 'b_chgrp' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:472:62: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'uid' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:99: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:233:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:233:9: note: in expansion of macro 'cmdinit' /usr/include/bits/stat.h:25: included_from: Included from here. /usr/include/fcntl.h:78: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast_sys.h:13: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast_std.h:66: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:32: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cmd.h:27: included_from: Included from here. # 470| gid = ent->fts_statp->st_gid; # 471| } # 472|-> if ((options & OPT_UNMAPPED) && (uid < 0 || gid < 0)) # 473| { # 474| if (uid < 0 && gid < 0) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:472:73: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'gid' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:233:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:233:9: note: in expansion of macro 'cmdinit' # 470| gid = ent->fts_statp->st_gid; # 471| } # 472|-> if ((options & OPT_UNMAPPED) && (uid < 0 || gid < 0)) # 473| { # 474| if (uid < 0 && gid < 0) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:481:33: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'uid' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:233:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:233:9: note: in expansion of macro 'cmdinit' # 479| error(ERROR_warn(0), "%s: GID not mapped", ent->fts_path); # 480| } # 481|-> if (uid != ent->fts_statp->st_uid && uid >= 0 || gid != ent->fts_statp->st_gid && gid >= 0) # 482| { # 483| if (options & (OPT_SHOW|OPT_VERBOSE)) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:481:78: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'gid' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:233:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/chgrp.c:233:9: note: in expansion of macro 'cmdinit' # 479| error(ERROR_warn(0), "%s: GID not mapped", ent->fts_path); # 480| } # 481|-> if (uid != ent->fts_statp->st_uid && uid >= 0 || gid != ent->fts_statp->st_gid && gid >= 0) # 482| { # 483| if (options & (OPT_SHOW|OPT_VERBOSE)) Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cmp.c:106: error[nullPointer]: Null pointer dereference: 1==(1)?(unsigned char*)0:_ccmap(1,1) # 104| { # 105| *s++ = ' '; # 106|-> c = ccmapc(o, CC_NATIVE, CC_ASCII); # 107| if (c & 0x80) # 108| { Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cmp.c:112: error[nullPointer]: Null pointer dereference: 1==(1)?(unsigned char*)0:_ccmap(1,1) # 110| *s++ = 'M'; # 111| c &= 0x7f; # 112|-> o = ccmapc(c, CC_ASCII, CC_NATIVE); # 113| } # 114| else Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cmp.c:122: error[nullPointer]: Null pointer dereference: 1==(1)?(unsigned char*)0:_ccmap(1,1) # 120| *s++ = '^'; # 121| c ^= 0x40; # 122|-> o = ccmapc(c, CC_ASCII, CC_NATIVE); # 123| } # 124| else if (m) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cp.c:548:13: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value # 546| if (errno == ENOENT) # 547| rm = 1; # 548|-> else if (!rm && st.st_mode && !remove(state->path)) # 549| { # 550| rm = 1; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cp.c:977:2: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 975| UNREACHABLE(); # 976| } # 977|-> memcpy(state->path, file, state->postsiz + 1); # 978| if (state->directory && state->path[state->postsiz - 1] != '/') # 979| state->path[state->postsiz++] = '/'; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cp.c:1015:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'state' # 1013| free(state); # 1014| } # 1015|-> return error_info.errors != 0; # 1016| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cut.c:194:9: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 192| qsort(lp=cut->list,n,2*sizeof(*lp),mycomp); # 193| /* eliminate overlapping regions */ # 194|-> for(n=0,range= -2,dp=lp; *lp!=HUGE; lp+=2) # 195| { # 196| if(lp[0] <= range) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cut.c:266:13: warning[deadcode.DeadStores]: Value stored to 'lp' during its initialization is never read # 264| int len; # 265| int ncol = 0; # 266|-> const int* lp = cut->list; # 267| char* bp; # 268| int skip; /* non-zero for don't copy */ Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cut.c: scope_hint: In function 'cutfields' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cut.c:563:27: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '(_Bool)nodelim' # 561| } # 562| /* see whether to save in tmp file */ # 563|-> if(inword && nodelim && !cut->sflag && (c=cp-first)>0) # 564| { # 565| /* copy line to tmpfile in case no fields */ Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/expr.c:339:11: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value # 337| np->num = 0; # 338| np->type = T_NUM; # 339|-> if (n = regcomp(&re, rp.str, REG_LEFT|REG_LENIENT)) # 340| regfatal(&re, ERROR_exit(2), n); # 341| if (!(n = regexec(&re, cp, elementsof(match), match, 0))) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/fmt.c:144:21: warning[core.UndefinedBinaryOperatorResult]: The left operand of '==' is a garbage value # 142| int prefix; # 143| # 144|-> for (ep = buf; *ep == ' '; ep++); # 145| prefix = ep - buf; # 146| Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/fmt.c:208:3: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 206| n = (ep-cp); # 207| } # 208|-> memcpy(fp->outp, cp, n); # 209| fp->outp += n; # 210| fp->nwords++; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/fold.c:216:2: warning[deadcode.DeadStores]: Value stored to 'argc' is never read # 214| } # 215| argv += opt_info.index; # 216|-> argc -= opt_info.index; # 217| if(error_info.errors) # 218| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:290:17: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 288| #endif # 289| if (flags & N_FLAG) # 290|-> name = (pw = getpwuid(user)) ? pw->pw_name : NULL; # 291| } # 292| if (ngroups == 1 && groups[0] == group) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c: scope_hint: In function 'getids' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:292:26: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'group' # 290| name = (pw = getpwuid(user)) ? pw->pw_name : NULL; # 291| } # 292|-> if (ngroups == 1 && groups[0] == group) # 293| ngroups = 0; # 294| if ((flags & N_FLAG) && (flags & G_FLAG)) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:292:32: warning[core.UndefinedBinaryOperatorResult]: The right operand of '==' is a garbage value # 290| name = (pw = getpwuid(user)) ? pw->pw_name : NULL; # 291| } # 292|-> if (ngroups == 1 && groups[0] == group) # 293| ngroups = 0; # 294| if ((flags & N_FLAG) && (flags & G_FLAG)) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:295:18: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 293| ngroups = 0; # 294| if ((flags & N_FLAG) && (flags & G_FLAG)) # 295|-> gname = (grp = getgrgid(group)) ? grp->gr_name : NULL; # 296| #if _lib_fsid # 297| if ((flags & N_FLAG) && (flags & S_FLAG)) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:295:32: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'group' # 293| ngroups = 0; # 294| if ((flags & N_FLAG) && (flags & G_FLAG)) # 295|-> gname = (grp = getgrgid(group)) ? grp->gr_name : NULL; # 296| #if _lib_fsid # 297| if ((flags & N_FLAG) && (flags & S_FLAG)) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:305:3: warning[core.CallAndMessage]: 5th function call argument is an uninitialized value # 303| if ((flags & (U_FLAG|G_FLAG|S_FLAG)) == (U_FLAG|G_FLAG|S_FLAG)) # 304| { # 305|-> putid(sp, flags, "uid", name, user); # 306| putid(sp, flags, " gid", gname, group); # 307| if ((flags & X_FLAG) && name) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:305:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'user' # 303| if ((flags & (U_FLAG|G_FLAG|S_FLAG)) == (U_FLAG|G_FLAG|S_FLAG)) # 304| { # 305|-> putid(sp, flags, "uid", name, user); # 306| putid(sp, flags, " gid", gname, group); # 307| if ((flags & X_FLAG) && name) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:306:3: warning[core.CallAndMessage]: 4th function call argument is an uninitialized value # 304| { # 305| putid(sp, flags, "uid", name, user); # 306|-> putid(sp, flags, " gid", gname, group); # 307| if ((flags & X_FLAG) && name) # 308| { Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:306:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'gname' # 304| { # 305| putid(sp, flags, "uid", name, user); # 306|-> putid(sp, flags, " gid", gname, group); # 307| if ((flags & X_FLAG) && name) # 308| { Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:368:8: warning[core.CallAndMessage]: 3rd function call argument is an uninitialized value # 366| { # 367| if ((flags & N_FLAG) && name) sfputr(sp, name, '\n'); # 368|-> else sfprintf(sp, "%u\n", user); # 369| } # 370| else if (flags & G_FLAG) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:368:22: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'user' # 366| { # 367| if ((flags & N_FLAG) && name) sfputr(sp, name, '\n'); # 368|-> else sfprintf(sp, "%u\n", user); # 369| } # 370| else if (flags & G_FLAG) Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:372:38: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'gname' # 370| else if (flags & G_FLAG) # 371| { # 372|-> if ((flags & N_FLAG) && gname) sfputr(sp, gname, '\n'); # 373| else sfprintf(sp, "%u\n", group); # 374| } Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/id.c:373:22: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'group' # 371| { # 372| if ((flags & N_FLAG) && gname) sfputr(sp, gname, '\n'); # 373|-> else sfprintf(sp, "%u\n", group); # 374| } # 375| else if (flags & GG_FLAG) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c: scope_hint: In function 'getolist' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:251:27: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outptr' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:90: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cmd.h:140:45: note: in expansion of macro 'CMD_CONTEXT' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cmd.h:27: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:214:27: note: in expansion of macro 'mbmax' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:190:30: note: in expansion of macro 'mbwide' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:197:44: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:198:44: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/error.h:31: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cmd.h:28: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:873:29: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:221:32: note: in expansion of macro 'newof' # 249| outmax = jp->outlist + nfield; # 250| } # 251|-> *outptr++ = c; # 252| cp = str; # 253| } Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:252:20: warning[-Wanalyzer-malloc-leak]: leak of 'outptr' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cmd.h:140:45: note: in expansion of macro 'CMD_CONTEXT' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:214:27: note: in expansion of macro 'mbmax' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:190:30: note: in expansion of macro 'mbwide' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:197:44: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:198:44: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:873:29: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:221:32: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:255:27: note: in definition of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:246:39: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:255:64: note: in definition of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:246:39: note: in expansion of macro 'newof' # 250| } # 251| *outptr++ = c; # 252|-> cp = str; # 253| } # 254| /* need to accept obsolescent command syntax */ Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:282:27: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outptr' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cmd.h:140:45: note: in expansion of macro 'CMD_CONTEXT' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:214:27: note: in expansion of macro 'mbmax' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:190:30: note: in expansion of macro 'mbwide' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:197:44: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:198:44: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:873:29: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:221:32: note: in expansion of macro 'newof' # 280| outmax = jp->outlist + nfield; # 281| } # 282|-> *outptr++ = c; # 283| } # 284| *outptr = -1; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:284:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outptr' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cmd.h:140:45: note: in expansion of macro 'CMD_CONTEXT' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:214:27: note: in expansion of macro 'mbmax' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:190:30: note: in expansion of macro 'mbwide' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:197:44: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:198:44: note: in expansion of macro 'newof' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:873:29: note: in expansion of macro 'opt_info' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/join.c:221:32: note: in expansion of macro 'newof' # 282| *outptr++ = c; # 283| } # 284|-> *outptr = -1; # 285| return argv-arglist; # 286| } Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/paste.c:244:18: warning[unix.Malloc]: Use of memory allocated with size zero # 242| while (cp < ep) # 243| { # 244|-> mp[dlen].chr = cp; # 245| mbchar(cp); # 246| mp[dlen].len = cp - mp[dlen].chr; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/rev.c:82:11: warning[core.NullDereference]: Dereference of null pointer # 80| xp = wp; # 81| while (cp < ep) # 82|-> *xp++ = mbchar(cp); # 83| cp = bp; # 84| while (xp > wp) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/rev.c: scope_hint: In function 'rev_char' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/rev.c:82:39: warning[-Wanalyzer-null-dereference]: dereference of NULL 'xp' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:36: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/cmd.h:27: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/rev.c:51: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/sfio.h:368:51: note: in expansion of macro '__sf_value' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/rev.c:70:38: note: in expansion of macro 'sfvalue' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:214:27: note: in expansion of macro 'mbmax' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:218:27: note: in expansion of macro 'mbwide' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:217:25: note: in expansion of macro 'mbnchar' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/rev.c:82:41: note: in expansion of macro 'mbchar' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:217:25: note: in expansion of macro 'mbnchar' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/rev.c:82:41: note: in expansion of macro 'mbchar' ksh-1.0.8-build/ksh-1.0.8/arch/linux.i386-64/include/ast/ast.h:217:25: note: in expansion of macro 'mbnchar' ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/rev.c:82:41: note: in expansion of macro 'mbchar' # 80| xp = wp; # 81| while (cp < ep) # 82|-> *xp++ = mbchar(cp); # 83| cp = bp; # 84| while (xp > wp) Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/uname.c:352:3: warning[deadcode.DeadStores]: Value stored to 's' is never read # 350| else # 351| { # 352|-> s = buf; # 353| if (!flags) # 354| flags = OPT_system; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libcmd/uniq.c:146:38: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value # 144| else # 145| reclen = -2; # 146|-> if(reclen==oreclen && (!reclen || !(*compare)(cp,orecp,reclen))) # 147| { # 148| count++; Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.8-build/ksh-1.0.8/src/lib/libdll/dllscan.c: scope_hint: In function 'dllinfo' ksh-1.0.8-build/ksh-1.0.8/src/lib/libdll/dllscan.c:146:45: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'vn' # 144| info.sibling[0] = info.sibbuf; # 145| } # 146|-> if (v && vn < sizeof(info.envbuf)) # 147| { # 148| memcpy(info.envbuf, v, vn); Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sumlib.c:152: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c: scope_hint: In function 'crc_open' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:135:26: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum.h:28: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sumlib.c:33: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:127:19: note: in expansion of macro 'newof' # 133| if(!strcmp(name, "crc-0x04c11db7-rotate-done-size")) # 134| { # 135|-> sum->init=0; # 136| sum->done=0xffffffff; # 137| sum->xorsize=0x0; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sumlib.c:152: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:148:11: warning[deadcode.DeadStores]: Although the value stored to 't' is used in the enclosing expression, the value is never actually read from 't' # 146| polynomial = 0xedb88320; # 147| s = name; # 148|-> while (*(t = s)) # 149| { # 150| for (t = s, v = 0; *s && *s != '-'; s++) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:157:71: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:127:19: note: in expansion of macro 'newof' # 155| polynomial = strtoul(t, NULL, 0); # 156| else if (strneq(t, "done", i)) # 157|-> sum->done = v ? strtoul(v + 1, NULL, 0) : ~sum->done; # 158| else if (strneq(t, "init", i)) # 159| sum->init = v ? strtoul(v + 1, NULL, 0) : ~sum->init; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:159:71: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:127:19: note: in expansion of macro 'newof' # 157| sum->done = v ? strtoul(v + 1, NULL, 0) : ~sum->done; # 158| else if (strneq(t, "init", i)) # 159|-> sum->init = v ? strtoul(v + 1, NULL, 0) : ~sum->init; # 160| else if (strneq(t, "rotate", i)) # 161| sum->rotate = 1; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:161:37: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:127:19: note: in expansion of macro 'newof' # 159| sum->init = v ? strtoul(v + 1, NULL, 0) : ~sum->init; # 160| else if (strneq(t, "rotate", i)) # 161|-> sum->rotate = 1; # 162| else if (strneq(t, "size", i)) # 163| { Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:164:38: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:127:19: note: in expansion of macro 'newof' # 162| else if (strneq(t, "size", i)) # 163| { # 164|-> sum->addsize = 1; # 165| if (v) # 166| sum->xorsize = strtoul(v + 1, NULL, 0); Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:171:16: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-crc.c:127:19: note: in expansion of macro 'newof' # 169| s++; # 170| } # 171|-> if (sum->rotate) # 172| { # 173| Crcnum_t t; Error: CLANG_WARNING: ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sumlib.c:153: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-prng.c:64:11: warning[deadcode.DeadStores]: Although the value stored to 't' is used in the enclosing expression, the value is never actually read from 't' # 62| } # 63| s = name; # 64|-> while (*(t = s)) # 65| { # 66| for (t = s, v = 0; *s && *s != '-'; s++) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sumlib.c:153: included_from: Included from here. ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-prng.c: scope_hint: In function 'prng_open' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-prng.c:71:34: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-prng.c:58:19: note: in expansion of macro 'newof' # 69| i = (v ? v : s) - t; # 70| if (isdigit(*t) || v && strneq(t, "mpy", i) && (t = v + 1)) # 71|-> sum->mpy = strtoul(t, NULL, 0); # 72| else if (strneq(t, "add", i)) # 73| sum->add = v ? strtoul(v + 1, NULL, 0) : ~sum->add; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-prng.c:73:70: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-prng.c:58:19: note: in expansion of macro 'newof' # 71| sum->mpy = strtoul(t, NULL, 0); # 72| else if (strneq(t, "add", i)) # 73|-> sum->add = v ? strtoul(v + 1, NULL, 0) : ~sum->add; # 74| else if (strneq(t, "init", i)) # 75| sum->init = v ? strtoul(v + 1, NULL, 0) : ~sum->init; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-prng.c:75:71: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-prng.c:58:19: note: in expansion of macro 'newof' # 73| sum->add = v ? strtoul(v + 1, NULL, 0) : ~sum->add; # 74| else if (strneq(t, "init", i)) # 75|-> sum->init = v ? strtoul(v + 1, NULL, 0) : ~sum->init; # 76| if (*s == '-') # 77| s++; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-prng.c:79:17: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.8-build/ksh-1.0.8/src/lib/libsum/sum-prng.c:58:19: note: in expansion of macro 'newof' # 77| s++; # 78| } # 79|-> if (!sum->mpy) # 80| { # 81| sum->mpy = FNV_MULT;