Task #55398 - ksh-1.0.10-5.fc43/scan-results.err
back to task #55398download
Error: COMPILER_WARNING: ksh-1.0.10/arch/linux.i386-64/include/ast/ast_std.h:34: included_from: Included from here. ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:32: included_from: Included from here. ksh-1.0.10/arch/linux.i386-64/src/cmd/ksh93/6f5f38473.c:2: included_from: Included from here. ksh-1.0.10/arch/linux.i386-64/include/ast/ast_standards.h:12:9: warning: 'basename' redefined ksh-1.0.10/arch/linux.i386-64/include/ast/ast_common.h:155: included_from: Included from here. ksh-1.0.10/arch/linux.i386-64/include/ast/bytesex.h:27: included_from: Included from here. ksh-1.0.10/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.10/arch/linux.i386-64/src/cmd/ksh93/6f5f38473.c:1: included_from: Included from here. ksh-1.0.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/cmd/ksh93/include/defs.h:47: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/init.c: scope_hint: In function 'sh_inittree' ksh-1.0.10/arch/linux.i386-64/include/ast/cdt.h:298:26: warning[-Wanalyzer-null-dereference]: dereference of NULL 'treep' ksh-1.0.10/src/cmd/ksh93/sh/init.c:1967:17: note: in expansion of macro 'dtinsert' ksh-1.0.10/src/cmd/ksh93/sh/init.c:1802:22: note: in expansion of macro 'sh_newof' ksh-1.0.10/src/cmd/ksh93/sh/init.c:1802:22: note: in expansion of macro 'sh_newof' ksh-1.0.10/src/cmd/ksh93/include/name.h:56: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:49: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/init.c:1963:20: note: in expansion of macro 'nv_isattr' ksh-1.0.10/src/cmd/ksh93/sh/init.c:1963:20: note: in expansion of macro 'nv_isattr' ksh-1.0.10/src/cmd/ksh93/sh/init.c:1967: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.10/arch/linux.i386-64/include/ast/ast.h:36: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:36: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c:24: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c: scope_hint: In function 'sh_outtype' ksh-1.0.10/arch/linux.i386-64/include/ast/sfio.h:294:35: warning[-Wanalyzer-null-dereference]: dereference of NULL 'iop' ksh-1.0.10/arch/linux.i386-64/include/ast/sfio.h:345:51: note: in expansion of macro '__sf_putc' ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c:1481:41: note: in expansion of macro 'sfputc' ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c:26: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c:1423:22: note: in expansion of macro 'L_ARGNOD' ksh-1.0.10/src/cmd/ksh93/include/defs.h:47: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c:1428:29: note: in expansion of macro 'dtfirst' ksh-1.0.10/src/cmd/ksh93/include/name.h:56: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:49: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/name.h:170:26: note: in expansion of macro 'nv_isattr' ksh-1.0.10/src/cmd/ksh93/include/name.h:171:27: note: in expansion of macro 'nv_isnonptr' ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c:1439:20: note: in expansion of macro 'nv_isnull' ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c:1443:28: note: in expansion of macro 'L_ARGNOD' ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c:1465:28: note: in expansion of macro 'nv_isattr' ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c:1472:36: note: in expansion of macro 'nv_isattr' ksh-1.0.10/arch/linux.i386-64/include/ast/sfio.h:345:51: note: in expansion of macro '__sf_putc' ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c:1481:41: note: in expansion of macro 'sfputc' ksh-1.0.10/arch/linux.i386-64/include/ast/sfio.h:345:51: note: in expansion of macro '__sf_putc' ksh-1.0.10/src/cmd/ksh93/sh/nvtype.c:1481:41: note: in expansion of macro 'sfputc' # 292| #define __sf_putm(f,v,m) (_sfputm(_SFIO_(f),(Sfulong_t)(v),(Sfulong_t)(m))) # 293| # 294|-> #define __sf_putc(f,c) (_SFIO_(f)->_next >= _SFIO_(f)->_endw ? \ # 295| _sfflsbuf(_SFIO_(f),(int)((unsigned char)(c))) : \ # 296| (int)(*_SFIO_(f)->_next++ = (unsigned char)(c)) ) Error: CPPCHECK_WARNING: ksh-1.0.10/arch/linux.i386-64/src/lib/libast/FEATURE/sfinit:673: error[internalError]: Internal Error. MathLib::toDoubleNumber: conversion failed: 1E309L # 671| 1E307L, # 672| 1E308L, # 673|-> 1E309L, # 674| 1E310L, # 675| 1E311L, Error: GCC_ANALYZER_WARNING (CWE-775): ksh-1.0.10/arch/linux.i386-64/src/lib/libast/conf.tmp.c: scope_hint: In function 'main' ksh-1.0.10/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.10/arch/linux.i386-64/src/lib/libast/conf.tmp.c: scope_hint: In function 'main' ksh-1.0.10/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.10/arch/linux.i386-64/src/lib/libast/conf.tmp.c:74:1: warning[-Woverflow]: unsigned conversion from 'long int' to 'unsigned int' changes value from '9223372036854775807' to '4294967295' Error: GCC_ANALYZER_WARNING (CWE-688): ksh-1.0.10/src/cmd/INIT/intl.c: scope_hint: In function 'main' ksh-1.0.10/src/cmd/INIT/intl.c:25:9: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected ksh-1.0.10/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.10/src/cmd/INIT/mamake.c: scope_hint: In function 'run.part.0' ksh-1.0.10/src/cmd/INIT/mamake.c:171:85: warning[-Wanalyzer-null-dereference]: dereference of NULL '*<unknown>.nxt' ksh-1.0.10/src/cmd/INIT/mamake.c:1383:33: note: in expansion of macro 'add' ksh-1.0.10/src/cmd/INIT/mamake.c:439:26: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:439:65: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:439:65: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:1383:33: note: in expansion of macro 'add' ksh-1.0.10/src/cmd/INIT/mamake.c:1383:33: note: in expansion of macro 'add' ksh-1.0.10/src/cmd/INIT/mamake.c:1383:33: note: in expansion of macro 'add' # 169| #define delimiter(c) (isspace(c)||(c)==';'||(c)=='('||(c)==')'||(c)=='`'||(c)=='|'||(c)=='&'||(c)=='=') # 170| # 171|-> #define add(b,c) (((b)->nxt >= (b)->end) ? append(b, "") : NULL, *(b)->nxt++ = (c)) # 172| #define getsize(b) ((b)->nxt-(b)->buf) # 173| #define setsize(b,o) ((b)->nxt=(b)->buf+(o)) Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'report.part.0' ksh-1.0.10/src/cmd/INIT/mamake.c:394:46: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>' ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'report.part.0' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'report.part.0' ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'report.part.0' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'report.part.0' # 392| fprintf(stderr, "warning: "); # 393| else if (level > 1) # 394|-> state.errors = 1; # 395| } # 396| if (item) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'buffer' ksh-1.0.10/src/cmd/INIT/mamake.c:441:23: warning[-Wanalyzer-null-dereference]: dereference of NULL 'buf' ksh-1.0.10/src/cmd/INIT/mamake.c:439:26: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:439:26: note: in expansion of macro 'newof' # 439| else if (!(buf = newof(0, Buf_t, 1, 0)) || !(buf->buf = newof(0, char, CHUNK, 0))) # 440| report(3, "out of memory [buffer]", NULL, 0); # 441|-> buf->end = buf->buf + CHUNK; # 442| buf->nxt = buf->buf; # 443| return buf; Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'appendn' ksh-1.0.10/src/cmd/INIT/mamake.c:468:20: warning[-Wanalyzer-malloc-leak]: leak of '*buf.buf' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' # 466| i = buf->nxt - buf->buf; # 467| m = (((buf->end - buf->buf) + n + CHUNK + 1) / CHUNK) * CHUNK; # 468|-> if (!(buf->buf = newof(buf->buf, char, m, 0))) # 469| report(3, "out of memory [buffer resize]", NULL, 0); # 470| buf->end = buf->buf + m; Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.10/src/cmd/INIT/mamake.c:470:26: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>' ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'appendn' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'appendn' ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'appendn' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'appendn' # 468| if (!(buf->buf = newof(buf->buf, char, m, 0))) # 469| report(3, "out of memory [buffer resize]", NULL, 0); # 470|-> buf->end = buf->buf + m; # 471| buf->nxt = buf->buf + i; # 472| } Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.10/src/cmd/INIT/mamake.c:471:26: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>' ksh-1.0.10/src/cmd/INIT/mamake.c:439:26: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:439:65: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:439:65: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c:468:34: note: in expansion of macro 'newof' ksh-1.0.10/src/cmd/INIT/mamake.c: scope_hint: In function 'appendn' # 469| report(3, "out of memory [buffer resize]", NULL, 0); # 470| buf->end = buf->buf + m; # 471|-> buf->nxt = buf->buf + i; # 472| } # 473| memcpy(buf->nxt, str, n + 1); Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.10/src/cmd/INIT/mamake.c:1679: error[nullPointer]: Null pointer dereference # 1677| append(tmp, lib + 2); # 1678| append(tmp, ".req"); # 1679|-> if (!(f = fopen(use(tmp), "r"))) # 1680| { # 1681| append(tmp, "%{INSTALLROOT}/lib/lib/"); Error: CPPCHECK_WARNING (CWE-682): ksh-1.0.10/src/cmd/INIT/mamake.c:1749: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer. # 1747| if (!all) # 1748| report(3, "out of memory [upd_allprev]", NULL, 0); # 1749|-> strcpy(all + nn, name); # 1750| auto_allprev->value = all; # 1751| /* restore ${?}, append to it if rule was updated */ Error: CPPCHECK_WARNING (CWE-682): ksh-1.0.10/src/cmd/INIT/mamake.c:1760: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer. # 1758| if (!upd) # 1759| report(3, "out of memory [upd_allprev]", NULL, 0); # 1760|-> strcpy(upd + nn, name); # 1761| } # 1762| auto_updprev->value = upd; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/cmd/ksh93/bltins/cd_pwd.c: scope_hint: In function 'b_cd' ksh-1.0.10/src/cmd/ksh93/bltins/cd_pwd.c:151:22: warning[-Wanalyzer-null-dereference]: dereference of NULL 'cp' ksh-1.0.10/arch/linux.i386-64/include/ast/error.h:31: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:45: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/bltins/cd_pwd.c:30: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/bltins/cd_pwd.c:89:17: note: in expansion of macro 'opt_info' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:36: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:36: included_from: Included from here. ksh-1.0.10/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: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.10/src/cmd/ksh93/bltins/misc.c: scope_hint: In function 'b_dot_cmd' ksh-1.0.10/src/cmd/ksh93/bltins/misc.c:336:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'saveargfor' ksh-1.0.10/src/cmd/ksh93/include/shell.h:34: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:69: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/bltins/misc.c:40: included_from: Included from here. ksh-1.0.10/arch/linux.i386-64/include/ast/stk.h:42:35: note: in definition of macro 'stkptr' ksh-1.0.10/src/cmd/ksh93/include/shell.h:40: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/bltins/misc.c:310:9: note: in expansion of macro 'sh_pushcontext' ksh-1.0.10/src/cmd/ksh93/include/fault.h:27: included_from: Included from here. # 334| update_sh_level(); # 335| if((np || argv[1]) && jmpval!=SH_JMPSCRIPT) # 336|-> sh_argreset((struct dolnod*)argsave,saveargfor); # 337| else # 338| { Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.10/src/cmd/ksh93/bltins/print.c:1024: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1022| } # 1023| if (format == '.') # 1024|-> value->i = value->ll; # 1025| if(*lastchar) # 1026| { Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.10/src/cmd/ksh93/bltins/print.c:1090: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1088| else # 1089| { # 1090|-> value->s = fmtelapsed(value->ll, 1); # 1091| fe->fmt = 's'; # 1092| fe->size = -1; Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.10/src/cmd/ksh93/bltins/print.c:1100: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1098| n = fe->t_str[fe->n_str]; # 1099| fe->t_str[fe->n_str] = 0; # 1100|-> value->s = fmttmx(fe->t_str, value->ll); # 1101| fe->t_str[fe->n_str] = n; # 1102| } Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.10/src/cmd/ksh93/bltins/print.c:1103: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 1101| fe->t_str[fe->n_str] = n; # 1102| } # 1103|-> else value->s = fmttmx(NULL, value->ll); # 1104| fe->fmt = 's'; # 1105| fe->size = -1; Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.10/src/cmd/ksh93/bltins/read.c: scope_hint: In function 'sh_readline' ksh-1.0.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/cmd/ksh93/bltins/test.c: scope_hint: In function 'test_strmatch' ksh-1.0.10/src/cmd/ksh93/bltins/test.c:86:19: warning[-Wanalyzer-null-dereference]: dereference of NULL 'cp' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:36: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:36: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/bltins/test.c:28: included_from: Included from here. ksh-1.0.10/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: CPPCHECK_WARNING (CWE-457): ksh-1.0.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/cmd/ksh93/edit/history.c: scope_hint: In function 'hist_word' ksh-1.0.10/src/cmd/ksh93/edit/history.c:1015:26: warning[-Wanalyzer-null-dereference]: dereference of NULL 'cp' # 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.10/src/cmd/ksh93/edit/history.c: scope_hint: In function 'hist_locate' ksh-1.0.10/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.10/src/cmd/ksh93/include/name.h:56: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:49: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/arith.c:26: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/arith.c: scope_hint: In function 'arith' ksh-1.0.10/src/cmd/ksh93/include/nval.h:213:38: warning[-Wanalyzer-null-dereference]: dereference of NULL 'np' ksh-1.0.10/src/cmd/ksh93/sh/arith.c:244:20: note: in expansion of macro 'nv_isattr' ksh-1.0.10/src/cmd/ksh93/sh/arith.c:244:20: note: in expansion of macro 'nv_isattr' # 211| # 212| /* name-value pair macros */ # 213|-> #define nv_isattr(np,f) ((np)->nvflag & (f)) # 214| #define nv_onattr(n,f) ((n)->nvflag |= (f)) # 215| #define nv_offattr(n,f) ((n)->nvflag &= ~(f)) Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.10/src/cmd/ksh93/sh/init.c:37: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/init.c: scope_hint: In function 'nv_init' ksh-1.0.10/src/cmd/ksh93/include/variables.h:100:28: warning[-Wanalyzer-malloc-leak]: leak of 'sh_calloc(1, 40)' ksh-1.0.10/src/cmd/ksh93/sh/init.c:1909:38: note: in expansion of macro 'SH_VERSIONNOD' ksh-1.0.10/src/cmd/ksh93/sh/init.c:31: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/init.c:1802:22: note: in expansion of macro 'sh_newof' ksh-1.0.10/src/cmd/ksh93/sh/init.c:1802:22: note: in expansion of macro 'sh_newof' ksh-1.0.10/src/cmd/ksh93/sh/init.c:1908:34: note: in expansion of macro 'sh_newof' ksh-1.0.10/src/cmd/ksh93/sh/init.c:1908:34: note: in expansion of macro 'sh_newof' ksh-1.0.10/src/cmd/ksh93/sh/init.c:1909: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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/cmd/ksh93/sh/array.c: scope_hint: In function 'array_maxindex' ksh-1.0.10/src/cmd/ksh93/sh/array.c:183:13: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' ksh-1.0.10/src/cmd/ksh93/include/name.h:56: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:49: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/array.c:29: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/array.c:1822:25: note: in expansion of macro 'nv_offattr' ksh-1.0.10/src/cmd/ksh93/include/name.h:171:67: note: in expansion of macro '_nv_hasget' ksh-1.0.10/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.10/src/cmd/ksh93/sh/expand.c: scope_hint: In function 'path_expand' ksh-1.0.10/src/cmd/ksh93/sh/expand.c:116:76: warning[-Wanalyzer-null-argument]: use of NULL 'trimmedpat' where non-null expected ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:36: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:36: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/expand.c:28: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/expand.c:107:30: note: in expansion of macro 'sfstruse' ksh-1.0.10/arch/linux.i386-64/include/ast/ast_sys.h:10: included_from: Included from here. ksh-1.0.10/arch/linux.i386-64/include/ast/ast_std.h:65: included_from: Included from here. ksh-1.0.10/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 = stkalloc(sh.stk,ARGVAL+strlen(pattern)+1); Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.10/src/cmd/ksh93/sh/expand.c: scope_hint: In function 'path_generate' ksh-1.0.10/src/cmd/ksh93/sh/expand.c:404:33: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'format' # 402| { # 403| *(rescan - 1) = 0; # 404|-> sfsprintf(pat=tmp,sizeof(tmp),format,first); # 405| *(rescan - 1) = '}'; # 406| *(cp = end) = 0; Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.10/src/cmd/ksh93/sh/init.c: scope_hint: In function 'nv_mapchar' ksh-1.0.10/src/cmd/ksh93/sh/init.c:2185:16: warning[-Wanalyzer-malloc-leak]: leak of 'sh_calloc(1, n + 72)' ksh-1.0.10/src/cmd/ksh93/sh/init.c:2172:14: note: in expansion of macro 'sh_newof' ksh-1.0.10/src/cmd/ksh93/sh/init.c:2172:14: note: in expansion of macro 'sh_newof' # 2183| } # 2184| mp->hdr.disc = &TRANS_disc; # 2185|-> return &mp->hdr; # 2186| } Error: GCC_ANALYZER_WARNING (CWE-1341): ksh-1.0.10/src/cmd/ksh93/sh/io.c: scope_hint: In function 'sh_close' ksh-1.0.10/src/cmd/ksh93/sh/io.c:719:26: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'fd' ksh-1.0.10/arch/linux.i386-64/include/ast/error.h:32: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:45: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/io.c:30: included_from: Included from here. # 717| if(fdnotify) # 718| (*fdnotify)(fd,SH_FDCLOSE); # 719|-> while((r=close(fd)) < 0 && errno==EINTR) # 720| errno = err; # 721| } Error: GCC_ANALYZER_WARNING: ksh-1.0.10/src/cmd/ksh93/sh/io.c: scope_hint: In function 'sh_iomovefd.part.0' ksh-1.0.10/src/cmd/ksh93/sh/io.c:910:17: warning[-Wanalyzer-fd-use-without-check]: 'dup' on possibly invalid file descriptor 'fdold' # 908| if(fdold<0 || fdold>2) # 909| return fdold; # 910|-> fdnew = sh_iomovefd(dup(fdold)); # 911| sh.fdstatus[fdnew] = (sh.fdstatus[fdold]&~IOCLEX); # 912| close(fdold); Error: CPPCHECK_WARNING (CWE-682): ksh-1.0.10/src/cmd/ksh93/sh/parse.c:1959: error[nullPointerArithmetic]: Pointer addition with NULL pointer. # 1957| case '(': # 1958| t = test_expr(lexp,')'); # 1959|-> t = makelist(lexp,TTST|TTEST|TPAREN ,t, (Shnode_t*)pointerof(sh.inlineno)); # 1960| break; # 1961| case '!': Error: GCC_ANALYZER_WARNING (CWE-1341): ksh-1.0.10/src/cmd/ksh93/sh/subshell.c: scope_hint: In function 'sh_subshell' ksh-1.0.10/src/cmd/ksh93/sh/subshell.c:736:31: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor '1' ksh-1.0.10/src/cmd/ksh93/include/fault.h:27: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/shell.h:40: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:69: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/sh/subshell.c:28: included_from: Included from here. ksh-1.0.10/arch/linux.i386-64/include/ast/error.h:32: included_from: Included from here. ksh-1.0.10/src/cmd/ksh93/include/defs.h:45: included_from: Included from here. # 734| { # 735| int err=errno; # 736|-> while(close(1)<0 && errno==EINTR) # 737| errno = err; # 738| if (fcntl(sp->tmpfd,F_DUPFD,1) != 1) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/cdt/dtview.c: scope_hint: In function 'dtvsearch.part.0' ksh-1.0.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/comp/regcmp.c: scope_hint: In function '_ast_regcmp' ksh-1.0.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/disc/sfdcmore.c: scope_hint: In function 'morewrite.part.0' ksh-1.0.10/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.10/src/lib/libast/disc/sfdcmore.c:311: error[memleak]: Memory leak: more # 309| { # 310| sfdisc(f, SFIO_POPDISC); # 311|-> return -1; # 312| } # 313| more->input = sfstdin; Error: CPPCHECK_WARNING (CWE-401): ksh-1.0.10/src/lib/libast/disc/sfdcmore.c:317: error[memleak]: Memory leak: more # 315| { # 316| sfdisc(f, SFIO_POPDISC); # 317|-> return -1; # 318| } # 319| more->error = sfstdin; Error: CPPCHECK_WARNING (CWE-401): ksh-1.0.10/src/lib/libast/disc/sfdcmore.c:322: error[memleak]: Memory leak: more # 320| } # 321| # 322|-> return 0; # 323| } Error: CPPCHECK_WARNING (CWE-682): ksh-1.0.10/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.10/src/lib/libast/hash/hashalloc.c: scope_hint: In function 'hashalloc' ksh-1.0.10/src/lib/libast/hash/hashalloc.c:146:33: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end' ksh-1.0.10/src/lib/libast/hash/hashlib.h:29: included_from: Included from here. ksh-1.0.10/src/lib/libast/hash/hashalloc.c:26: included_from: Included from here. ksh-1.0.10/src/lib/libast/hash/hashalloc.c:81:40: note: in expansion of macro 'newof' # 144| if (vp < &va[elementsof(va)]) # 145| { # 146|-> va_copy(*vp, ap); # 147| vp++; # 148| } Error: GCC_ANALYZER_WARNING (CWE-404): ksh-1.0.10/src/lib/libast/hash/hashalloc.c:160:25: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end' ksh-1.0.10/src/lib/libast/hash/hashalloc.c:64:26: note: in expansion of macro 'newof' # 158| } # 159| #else # 160|-> va_copy(ap, va_listval(va_arg(ap, va_listarg))); # 161| #endif # 162| break; Error: GCC_ANALYZER_WARNING (CWE-404): ksh-1.0.10/src/lib/libast/hash/hashalloc.c:167:33: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end' ksh-1.0.10/src/lib/libast/hash/hashalloc.c:81:40: note: in expansion of macro 'newof' # 165| { # 166| vp--; # 167|-> va_copy(ap, *vp); # 168| break; # 169| } Error: GCC_ANALYZER_WARNING (CWE-416): ksh-1.0.10/src/lib/libast/hash/hashfree.c: scope_hint: In function 'hashfree' ksh-1.0.10/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.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/hash/hashlook.c: scope_hint: In function 'hashlook' ksh-1.0.10/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.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/include/ast.h:36: included_from: Included from here. ksh-1.0.10/src/lib/libast/misc/optlib.h:30: included_from: Included from here. ksh-1.0.10/src/lib/libast/misc/optget.c:30: included_from: Included from here. ksh-1.0.10/src/lib/libast/misc/optget.c: scope_hint: In function 'expand' ksh-1.0.10/src/lib/libast/include/sfio.h:384:37: warning[-Wanalyzer-null-dereference]: dereference of NULL 'ip' ksh-1.0.10/src/lib/libast/misc/optget.c:843:13: note: in expansion of macro 'sfstrtell' ksh-1.0.10/src/lib/libast/include/error.h:31: included_from: Included from here. ksh-1.0.10/src/lib/libast/misc/optlib.h:109: included_from: Included from here. ksh-1.0.10/src/lib/libast/misc/optget.c:5752:17: note: in expansion of macro 'opt_info' ksh-1.0.10/src/lib/libast/misc/optget.c:843:13: note: in expansion of macro 'sfstrtell' # 382| # 383| #define sfstrsize(f) ((f)->_size) # 384|-> #define sfstrtell(f) ((f)->_next - (f)->_data) # 385| #define sfstrpend(f) ((f)->_size - sfstrtell()) # 386| #define sfstrbase(f) ((char*)(f)->_data) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/misc/fastfind.c: scope_hint: In function 'findopen' ksh-1.0.10/src/lib/libast/misc/fastfind.c:640:21: warning[-Wanalyzer-null-dereference]: dereference of NULL 'fp' # 638| nomemory: # 639| if (disc->errorf) # 640|-> (*fp->disc->errorf)(fp, fp->disc, 2, "out of memory"); # 641| if (!fp) # 642| return NULL; Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/misc/fastfind.c: scope_hint: In function 'findread' ksh-1.0.10/src/lib/libast/misc/fastfind.c:828:36: warning[-Wanalyzer-null-dereference]: dereference of NULL 'p' # 826| fp->lens++; # 827| } # 828|-> if (fp->verify && (*p == '/' || t == 1)) # 829| { # 830| if ((n = p - fp->decode.path)) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/misc/fastfind.c:856:37: warning[-Wanalyzer-null-dereference]: dereference of NULL 'p' ksh-1.0.10/src/lib/libast/misc/fastfind.c:74: included_from: Included from here. ksh-1.0.10/src/lib/libast/misc/fastfind.c:852:21: note: in expansion of macro 'FF_OK_TYPE' # 854| if (fp->decode.end) # 855| { # 856|-> if (*(s = p) == '/') # 857| s--; # 858| if (*fp->decode.pattern == '/' && b > fp->decode.path) Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/misc/fastfind.c:885:37: warning[-Wanalyzer-null-dereference]: dereference of NULL 'p' ksh-1.0.10/src/lib/libast/misc/fastfind.c:852:21: note: in expansion of macro 'FF_OK_TYPE' # 883| { # 884| fp->decode.peek = c; # 885|-> if (*p == '/' && p > fp->decode.path) # 886| *(fp->decode.restore = p) = 0; # 887| if (!fp->secure || !access(fp->decode.path, F_OK)) Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.10/src/lib/libast/misc/fts.c: scope_hint: In function 'fts_read' ksh-1.0.10/src/lib/libast/misc/fts.c:172:16: warning[-Wanalyzer-malloc-leak]: leak of 'node(fts, *fts.current, s, i)' ksh-1.0.10/src/lib/libast/misc/fts.c:28: included_from: Included from here. ksh-1.0.10/src/lib/libast/misc/fts.c:180:27: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libast/misc/fts.c:107:39: note: in definition of macro 'TYPE' ksh-1.0.10/src/lib/libast/misc/fts.c:1024:41: note: in expansion of macro 'D_TYPE' ksh-1.0.10/src/lib/libast/dir/dirlib.h:35: included_from: Included from here. ksh-1.0.10/src/lib/libast/include/ast_dir.h:40: included_from: Included from here. ksh-1.0.10/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.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/misc/fts.c: scope_hint: In function 'getlist' ksh-1.0.10/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: CPPCHECK_WARNING (CWE-562): ksh-1.0.10/src/lib/libast/misc/glob.c:668: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 666| gp->gl_lstat = (GL_stat_f)lstat; # 667| if (!gp->gl_intr) # 668|-> gp->gl_intr = &intr; # 669| if (!gp->gl_delim) # 670| gp->gl_delim = '/'; Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/misc/magic.c:2048: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ep->value.loop # 2046| { # 2047| ep->value.loop = calloc(1, sizeof(Loop_t)); # 2048|-> ep->value.loop->lab = fun[n]; # 2049| while (*p && *p++ != ','); # 2050| ep->value.loop->start = strton(p, &t, NULL, 0); Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/misc/magic.c: scope_hint: In function 'magiclist' ksh-1.0.10/src/lib/libast/misc/magic.c:2407:28: warning[-Wanalyzer-null-dereference]: dereference of NULL 'ep' # 2405| ep->value.lab->mask = 1; # 2406| } # 2407|-> ep = ep->next; # 2408| } # 2409| } Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.10/src/lib/libast/misc/optget.c: scope_hint: In function 'optget' ksh-1.0.10/src/lib/libast/misc/optget.c:1189:13: warning[-Wanalyzer-malloc-leak]: leak of 'info(psp, next(s, version) + 1, 0, xp, id)' ksh-1.0.10/src/lib/libast/misc/optget.c:5752:17: note: in expansion of macro 'opt_info' ksh-1.0.10/src/lib/libast/misc/optget.c:1191:19: note: in expansion of macro 'newof' # 1187| static Push_t push; # 1188| # 1189|-> b = expand(s, e, &s, ip, id); # 1190| n = strlen(b); # 1191| if (tsp = newof(0, Push_t, 1, n + 1)) Error: COMPILER_WARNING (CWE-126): ksh-1.0.10/src/lib/libast/misc/optget.c: scope_hint: In function 'args' ksh-1.0.10/src/lib/libast/misc/optget.c:1605:36: warning[-Wstringop-overread]: 'memchr' specified bound [18446744071562067968, 0] exceeds maximum object size 9223372036854775807 # 1605 | t = (char*)memchr(p, '\n', n); # | ^~~~~~~~~~~~~~~~~~ # 1603| for (;;) # 1604| { # 1605|-> t = (char*)memchr(p, '\n', n); # 1606| if (style >= STYLE_man) # 1607| { Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/misc/optget.c:4145: error[ctunullpointer]: Null pointer dereference: e # 4143| n = strtonll(s, t, &lastbase, 0); # 4144| } # 4145|-> *e = errno; # 4146| errno = oerrno; # 4147| return n; Error: CPPCHECK_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/misc/optget.c:4145: warning[nullPointer]: Possible null pointer dereference: e # 4143| n = strtonll(s, t, &lastbase, 0); # 4144| } # 4145|-> *e = errno; # 4146| errno = oerrno; # 4147| return n; Error: GCC_ANALYZER_WARNING (CWE-124): ksh-1.0.10/src/lib/libast/misc/optget.c:4786:70: warning[-Wanalyzer-out-of-bounds]: buffer underwrite ksh-1.0.10/src/lib/libast/misc/optget.c:5752:17: note: in expansion of macro 'opt_info' ksh-1.0.10/src/lib/libast/include/sfio.h:345:51: note: in expansion of macro '__sf_putc' ksh-1.0.10/src/lib/libast/misc/optget.c:4783:49: note: in expansion of macro 'sfputc' ksh-1.0.10/src/lib/libast/include/sfio.h:345:51: note: in expansion of macro '__sf_putc' ksh-1.0.10/src/lib/libast/misc/optget.c:4783:49: note: in expansion of macro 'sfputc' ksh-1.0.10/src/lib/libast/include/sfio.h:345:51: note: in expansion of macro '__sf_putc' ksh-1.0.10/src/lib/libast/misc/optget.c:4783:49: note: in expansion of macro 'sfputc' ksh-1.0.10/src/lib/libast/misc/optget.c:868:17: note: in expansion of macro 'sfstruse' ksh-1.0.10/src/lib/libast/misc/optget.c:4786:70: note: valid subscripts for '"error"' are '[0]' to '[5]' # 4784| s = expand(s + 2, NULL, &t, vp, id); # 4785| if (*s) # 4786|-> *(f = s - 1) = k; # 4787| else # 4788| { Error: GCC_ANALYZER_WARNING (CWE-471): ksh-1.0.10/src/lib/libast/misc/optget.c:4786:70: warning[-Wanalyzer-write-to-string-literal]: write to string literal ksh-1.0.10/src/lib/libast/misc/optget.c:5752:17: note: in expansion of macro 'opt_info' ksh-1.0.10/src/lib/libast/include/sfio.h:345:51: note: in expansion of macro '__sf_putc' ksh-1.0.10/src/lib/libast/misc/optget.c:4783:49: note: in expansion of macro 'sfputc' ksh-1.0.10/src/lib/libast/include/sfio.h:345:51: note: in expansion of macro '__sf_putc' ksh-1.0.10/src/lib/libast/misc/optget.c:4783:49: note: in expansion of macro 'sfputc' ksh-1.0.10/src/lib/libast/include/sfio.h:345:51: note: in expansion of macro '__sf_putc' ksh-1.0.10/src/lib/libast/misc/optget.c:4783:49: note: in expansion of macro 'sfputc' ksh-1.0.10/src/lib/libast/misc/optget.c:868:17: note: in expansion of macro 'sfstruse' # 4784| s = expand(s + 2, NULL, &t, vp, id); # 4785| if (*s) # 4786|-> *(f = s - 1) = k; # 4787| else # 4788| { Error: GCC_ANALYZER_WARNING: ksh-1.0.10/src/lib/libast/misc/procopen.c: scope_hint: In function 'procopen' ksh-1.0.10/src/lib/libast/misc/procopen.c:560:41: warning[-Wanalyzer-fd-use-without-check]: 'write' on possibly invalid file descriptor '-1' # 558| { # 559| if (proc->pid > 0) # 560|-> write(pop[1], &proc->pid, sizeof(proc->pid)); # 561| _exit(EXIT_NOEXEC); # 562| } Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/misc/stk.c: scope_hint: In function 'stkinstall' ksh-1.0.10/src/lib/libast/misc/stk.c:251:33: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sp' # 249| sp = stkcur; # 250| if(oflow) # 251|-> sp->stkoverflow = (_stk_overflow_)oflow; # 252| return old; # 253| } Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/misc/translate.c: scope_hint: In function 'match' ksh-1.0.10/src/lib/libast/misc/translate.c:249:28: warning[-Wanalyzer-null-dereference]: dereference of NULL 't' ksh-1.0.10/src/lib/libast/misc/translate.c:26: included_from: Included from here. ksh-1.0.10/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: COMPILER_WARNING (CWE-562): ksh-1.0.10/src/lib/libast/path/pathkey.c: scope_hint: In function 'pathkey_20100601' ksh-1.0.10/src/lib/libast/path/pathkey.c:289:41: warning[-Wreturn-local-addr]: function may return address of local variable # 289 | return key == buf ? strdup(key) : key; # | ^ ksh-1.0.10/src/lib/libast/path/pathkey.c:58:25: note: declared here # 58 | char buf[15]; # | ^ # 287| #pragma GCC diagnostic ignored "-Wreturn-local-addr" # 288| #endif # 289|-> return key == buf ? strdup(key) : key; # 290| } Error: COMPILER_WARNING (CWE-562): ksh-1.0.10/src/lib/libast/path/pathpath.c: scope_hint: In function 'pathpath_20100601' ksh-1.0.10/src/lib/libast/path/pathpath.c:130:1: warning[-Wreturn-local-addr]: function may return address of local variable # 130 | } # | ^ ksh-1.0.10/src/lib/libast/path/pathpath.c:52:25: note: declared here # 52 | char buf[PATH_MAX]; # | ^ ksh-1.0.10/src/lib/libast/path/pathpath.c:52:25: note: declared here # 128| #endif # 129| return (s && path == buf) ? strdup(s) : s; # 130|-> } Error: GCC_ANALYZER_WARNING (CWE-131): ksh-1.0.10/src/lib/libast/path/pathtemp.c: scope_hint: In function 'pathtemp' ksh-1.0.10/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.10/src/lib/libast/path/pathtemp.c:69: included_from: Included from here. ksh-1.0.10/src/lib/libast/path/pathtemp.c:229:49: note: in expansion of macro 'newof' ksh-1.0.10/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.10/src/lib/libast/port/astconf.c: scope_hint: In function 'synthesize.part.0' ksh-1.0.10/src/lib/libast/port/astconf.c:334:20: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>' ksh-1.0.10/src/lib/libast/include/ast.h:32: included_from: Included from here. ksh-1.0.10/src/lib/libast/misc/univlib.h:40: included_from: Included from here. ksh-1.0.10/src/lib/libast/port/astconf.c:26: included_from: Included from here. ksh-1.0.10/src/lib/libast/port/astconf.c:325:49: note: in expansion of macro 'getenv' ksh-1.0.10/src/lib/libast/port/astconf.c:328:36: note: in expansion of macro 'newof' # 332| state.data += state.prefix - 1; # 333| *state.data++ = '='; # 334|-> if (s) # 335| strcpy(state.data, s); # 336| ve = state.data; Error: GCC_ANALYZER_WARNING (CWE-775): ksh-1.0.10/src/lib/libast/port/lcgen.c: scope_hint: In function 'main' ksh-1.0.10/src/lib/libast/port/lcgen.c:273:12: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(hdr, "w")' # 271| return 1; # 272| } # 273|-> if (!(lf = fopen(lib, "w"))) # 274| { # 275| fprintf(stderr, "%s: %s: cannot write\n", command, lib); Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.10/src/lib/libast/port/lcgen.c:273:12: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(hdr, "w")' # 271| return 1; # 272| } # 273|-> if (!(lf = fopen(lib, "w"))) # 274| { # 275| fprintf(stderr, "%s: %s: cannot write\n", command, lib); Error: CPPCHECK_WARNING (CWE-404): ksh-1.0.10/src/lib/libast/port/lcgen.c:276: error[resourceLeak]: Resource leak: hf # 274| { # 275| fprintf(stderr, "%s: %s: cannot write\n", command, lib); # 276|-> return 1; # 277| } # 278| type = 0; Error: GCC_ANALYZER_WARNING (CWE-775): ksh-1.0.10/src/lib/libast/port/lcgen.c:310:20: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(hdr, "w")' # 308| fprintf(lf, "#include \"lclang.h\"\n"); # 309| fprintf(lf, "\n"); # 310|-> while (s = fgets(buf, sizeof(buf), stdin)) # 311| { # 312| line++; Error: GCC_ANALYZER_WARNING (CWE-775): ksh-1.0.10/src/lib/libast/port/lcgen.c:310:20: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(lib, "w")' # 308| fprintf(lf, "#include \"lclang.h\"\n"); # 309| fprintf(lf, "\n"); # 310|-> while (s = fgets(buf, sizeof(buf), stdin)) # 311| { # 312| line++; Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.10/src/lib/libast/port/lcgen.c:310:20: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(hdr, "w")' # 308| fprintf(lf, "#include \"lclang.h\"\n"); # 309| fprintf(lf, "\n"); # 310|-> while (s = fgets(buf, sizeof(buf), stdin)) # 311| { # 312| line++; Error: GCC_ANALYZER_WARNING (CWE-401): ksh-1.0.10/src/lib/libast/port/lcgen.c:310:20: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(lib, "w")' # 308| fprintf(lf, "#include \"lclang.h\"\n"); # 309| fprintf(lf, "\n"); # 310|-> while (s = fgets(buf, sizeof(buf), stdin)) # 311| { # 312| line++; Error: CPPCHECK_WARNING (CWE-457): ksh-1.0.10/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: CPPCHECK_WARNING (CWE-476): ksh-1.0.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/regex/regexec.c: scope_hint: In function 'regexec_20120528.part.0' ksh-1.0.10/src/lib/libast/regex/regexec.c:38:42: warning[-Wanalyzer-null-dereference]: dereference of NULL 'match' ksh-1.0.10/src/lib/libast/regex/regexec.c:61:1: note: in expansion of macro 'regexec' # 36| { # 37| int r; # 38|-> int m = match->rm_so; # 39| regmatch_t* e; # 40| Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.10/src/lib/libast/regex/regexec.c:38:42: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*match.rm_so' ksh-1.0.10/src/lib/libast/regex/regexec.c:61:1: note: in expansion of macro 'regexec' ksh-1.0.10/src/lib/libast/regex/reglib.h:56: included_from: Included from here. ksh-1.0.10/src/lib/libast/regex/regexec.c:26: included_from: Included from here. ksh-1.0.10/src/lib/libast/regex/regexec.c:69:31: note: in expansion of macro 'oldof' ksh-1.0.10/src/lib/libast/regex/regexec.c:69: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.10/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: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.10/src/lib/libast/regex/regrexec.c: scope_hint: In function '_ast_regrexec' ksh-1.0.10/src/lib/libast/regex/regrexec.c:166:61: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*<unknown>.rm_so' ksh-1.0.10/src/lib/libast/regex/regrexec.c:153:1: note: in expansion of macro 'regrexec' ksh-1.0.10/src/lib/libast/regex/reglib.h:56: included_from: Included from here. ksh-1.0.10/src/lib/libast/regex/regrexec.c:26: included_from: Included from here. ksh-1.0.10/src/lib/libast/regex/regrexec.c:161:31: note: in expansion of macro 'oldof' ksh-1.0.10/src/lib/libast/regex/regrexec.c:161:31: note: in expansion of macro 'oldof' # 164| for (i = 0; i < nmatch; i++) # 165| { # 166|-> oldmatch[i].rm_so = match[i].rm_so; # 167| oldmatch[i].rm_eo = match[i].rm_eo; # 168| } Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.10/src/lib/libast/sfio/_sfputd.c: scope_hint: In function '_sfputd' ksh-1.0.10/src/lib/libast/sfio/_sfputd.c:76:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'c[255]' ksh-1.0.10/src/lib/libast/sfio/_sfputd.c:19: included_from: Included from here. ksh-1.0.10/src/lib/libast/sfio/_sfputd.c:58:9: note: in expansion of macro 'SFOPEN' ksh-1.0.10/src/lib/libast/sfio/_sfputd.c:61:9: note: in expansion of macro 'SFLOCK' # 74| /* last byte is not SFIO_MORE */ # 75| ends = &c[0] + sizeof(c) -1; # 76|-> *ends &= ~SFIO_MORE; # 77| # 78| /* write out coded bytes */ Error: CPPCHECK_WARNING: ksh-1.0.10/src/lib/libast/sfio/sfcvt.c:165: error[internalError]: Internal Error. MathLib::toDoubleNumber: conversion failed: 1.18973149535723176502126385303097021e+4932L # 163| if(f < LDBL_MIN) # 164| return SFIO_ZERO; # 165|-> if(f > LDBL_MAX) # 166| return SFIO_INF; # 167| Error: GCC_ANALYZER_WARNING (CWE-1341): ksh-1.0.10/src/lib/libast/sfio/sfmode.c:20: included_from: Included from here. ksh-1.0.10/src/lib/libast/sfio/sfmode.c: scope_hint: In function '_sfpclose' ksh-1.0.10/src/lib/libast/sfio/sfhdr.h:470:33: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor '((Sfproc_t)**f.proc).file' ksh-1.0.10/src/lib/libast/sfio/sfmode.c:221:25: note: in expansion of macro 'CLOSE' ksh-1.0.10/src/lib/libast/sfio/sfmode.c:221:25: note: in expansion of macro 'CLOSE' ksh-1.0.10/src/lib/libast/sfio/sfmode.c:221:25: note: in expansion of macro 'CLOSE' ksh-1.0.10/src/lib/libast/sfio/sfmode.c:221:25: note: in expansion of macro 'CLOSE' ksh-1.0.10/src/lib/libast/sfio/sfmode.c:221:25: note: in expansion of macro 'CLOSE' # 468| # 469| /* safe closing function */ # 470|-> #define CLOSE(f) { while(close(f) < 0 && errno == EINTR) errno = 0; } # 471| # 472| /* the bottomless bit bucket */ Error: CPPCHECK_WARNING: ksh-1.0.10/src/lib/libast/sfio/sfstrtof.h:534: error[internalError]: Internal Error. MathLib::toDoubleNumber: conversion failed: 1.18973149535723176502126385303097021e+4932L # 532| v = 0; # 533| } # 534|-> else if (v > S2F_max) # 535| { # 536| ERR(ERANGE); Error: GCC_ANALYZER_WARNING (CWE-404): ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c: scope_hint: In function 'sfvprintf' ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:154:24: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end' ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:213:25: note: in expansion of macro 'SFputc' ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:119:43: note: in expansion of macro 'SFBUF' ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:140:55: note: in expansion of macro 'SMputc' ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:213:25: note: in expansion of macro 'SFputc' ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:1418:9: note: in expansion of macro 'SFEND' ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:22: included_from: Included from here. ksh-1.0.10/src/lib/libast/sfio/sfhdr.h:514:77: note: in expansion of macro '_SFOPEN' ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:1430:9: note: in expansion of macro 'SFOPEN' ksh-1.0.10/src/lib/libast/sfio/sfhdr.h:510:52: note: in expansion of macro '_SFOPENRD' ksh-1.0.10/src/lib/libast/sfio/sfhdr.h:514:77: note: in expansion of macro '_SFOPEN' ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:1430: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-758): ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:556: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 554| { if(size == sizeof(short)) # 555| { if(_Sftype[fmt]&SFFMT_INT) # 556|-> argv.i = argv.h; # 557| else argv.i = argv.uh; # 558| } Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:557: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 555| { if(_Sftype[fmt]&SFFMT_INT) # 556| argv.i = argv.h; # 557|-> else argv.i = argv.uh; # 558| } # 559| else if(size == sizeof(char)) Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:561: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 559| else if(size == sizeof(char)) # 560| { if(_Sftype[fmt]&SFFMT_INT) # 561|-> argv.i = argv.c; # 562| else argv.i = argv.uc; # 563| } Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:562: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 560| { if(_Sftype[fmt]&SFFMT_INT) # 561| argv.i = argv.c; # 562|-> else argv.i = argv.uc; # 563| } # 564| } Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:567: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 565| else if(_Sftype[fmt]&SFFMT_FLOAT ) # 566| { if(size == sizeof(float) ) # 567|-> argv.d = argv.f; # 568| } # 569| else if(_Sftype[fmt]&SFFMT_CHAR) Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:571: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 569| else if(_Sftype[fmt]&SFFMT_CHAR) # 570| { if(base < 0) # 571|-> argv.i = (int)argv.c; # 572| } # 573| } Error: CPPCHECK_WARNING (CWE-758): ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:850: error[overlappingWriteUnion]: Overlapping read/write of union is undefined behavior # 848| } # 849| else # 850|-> { argv.c = (char)(argv.i); # 851| sp = &argv.c; # 852| size = 1; Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:873:60: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*sp' # 871| #endif # 872| if(flags&SFFMT_ALTER) # 873|-> { n_s = chr2str(buf, *sp++); # 874| n = width - precis*n_s; # 875| } Error: GCC_ANALYZER_WARNING (CWE-457): ksh-1.0.10/src/lib/libast/sfio/sfvprintf.c:877:47: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*sp' # 875| } # 876| else # 877|-> { fmt = *sp++; # 878| n = width - precis; # 879| } Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libast/sfio/sfvscanf.c: scope_hint: In function 'sfvscanf' ksh-1.0.10/src/lib/libast/sfio/sfvscanf.c:729:48: warning[-Wanalyzer-null-dereference]: dereference of NULL 'value' ksh-1.0.10/src/lib/libast/sfio/sfvscanf.c:307:75: note: in expansion of macro 'SFbuf' ksh-1.0.10/src/lib/libast/sfio/sfvscanf.c:321:9: note: in expansion of macro 'SFinit' ksh-1.0.10/src/lib/libast/sfio/sfvscanf.c:307:75: note: in expansion of macro 'SFbuf' ksh-1.0.10/src/lib/libast/sfio/sfvscanf.c:321:9: note: in expansion of macro 'SFinit' ksh-1.0.10/src/lib/libast/sfio/sfvscanf.c:20: included_from: Included from here. ksh-1.0.10/src/lib/libast/sfio/sfvscanf.c:632:24: note: in expansion of macro 'FP_SET' ksh-1.0.10/src/lib/libast/sfio/sfvscanf.c:632:24: note: in expansion of macro 'FP_SET' ksh-1.0.10/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.10/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-664): ksh-1.0.10/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.10/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.10/src/lib/libast/string/tokscan.c: scope_hint: In function 'tokscan' ksh-1.0.10/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: CPPCHECK_WARNING (CWE-682): ksh-1.0.10/src/lib/libcmd/join.c:222: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer. # 220| # 221| outptr = jp->outlist = newof(0, int, NFIELD + 1, 0); # 222|-> outmax = outptr + NFIELD; # 223| while (c = *cp++) # 224| { Error: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libcmd/join.c: scope_hint: In function 'getolist' ksh-1.0.10/src/lib/libcmd/join.c:251:27: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outptr' ksh-1.0.10/src/lib/libcmd/join.c:90: included_from: Included from here. ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/src/lib/libcmd/cmd.h:140:45: note: in expansion of macro 'CMD_CONTEXT' ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/src/lib/libcmd/cmd.h:27: included_from: Included from here. ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:209:27: note: in expansion of macro 'mbmax' ksh-1.0.10/src/lib/libcmd/join.c:190:30: note: in expansion of macro 'mbwide' ksh-1.0.10/src/lib/libcmd/join.c:197:44: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libcmd/join.c:198:44: note: in expansion of macro 'newof' ksh-1.0.10/arch/linux.i386-64/include/ast/error.h:31: included_from: Included from here. ksh-1.0.10/src/lib/libcmd/cmd.h:28: included_from: Included from here. ksh-1.0.10/src/lib/libcmd/join.c:873:29: note: in expansion of macro 'opt_info' ksh-1.0.10/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.10/src/lib/libcmd/join.c:252:20: warning[-Wanalyzer-malloc-leak]: leak of 'outptr' ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/src/lib/libcmd/cmd.h:140:45: note: in expansion of macro 'CMD_CONTEXT' ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:209:27: note: in expansion of macro 'mbmax' ksh-1.0.10/src/lib/libcmd/join.c:190:30: note: in expansion of macro 'mbwide' ksh-1.0.10/src/lib/libcmd/join.c:197:44: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libcmd/join.c:198:44: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libcmd/join.c:873:29: note: in expansion of macro 'opt_info' ksh-1.0.10/src/lib/libcmd/join.c:221:32: note: in expansion of macro 'newof' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:250:27: note: in definition of macro 'newof' ksh-1.0.10/src/lib/libcmd/join.c:246:39: note: in expansion of macro 'newof' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:250:64: note: in definition of macro 'newof' ksh-1.0.10/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.10/src/lib/libcmd/join.c:282:27: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outptr' ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/src/lib/libcmd/cmd.h:140:45: note: in expansion of macro 'CMD_CONTEXT' ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:209:27: note: in expansion of macro 'mbmax' ksh-1.0.10/src/lib/libcmd/join.c:190:30: note: in expansion of macro 'mbwide' ksh-1.0.10/src/lib/libcmd/join.c:197:44: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libcmd/join.c:198:44: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libcmd/join.c:873:29: note: in expansion of macro 'opt_info' ksh-1.0.10/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.10/src/lib/libcmd/join.c:284:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'outptr' ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/src/lib/libcmd/cmd.h:140:45: note: in expansion of macro 'CMD_CONTEXT' ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/src/lib/libcmd/join.c:822:9: note: in expansion of macro 'cmdinit' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:209:27: note: in expansion of macro 'mbmax' ksh-1.0.10/src/lib/libcmd/join.c:190:30: note: in expansion of macro 'mbwide' ksh-1.0.10/src/lib/libcmd/join.c:197:44: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libcmd/join.c:198:44: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libcmd/join.c:873:29: note: in expansion of macro 'opt_info' ksh-1.0.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libcmd/rev.c: scope_hint: In function 'rev_char' ksh-1.0.10/src/lib/libcmd/rev.c:82:39: warning[-Wanalyzer-null-dereference]: dereference of NULL 'xp' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:36: included_from: Included from here. ksh-1.0.10/src/lib/libcmd/cmd.h:27: included_from: Included from here. ksh-1.0.10/src/lib/libcmd/rev.c:51: included_from: Included from here. ksh-1.0.10/arch/linux.i386-64/include/ast/sfio.h:357:51: note: in expansion of macro '__sf_value' ksh-1.0.10/src/lib/libcmd/rev.c:70:38: note: in expansion of macro 'sfvalue' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:209:27: note: in expansion of macro 'mbmax' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:213:27: note: in expansion of macro 'mbwide' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:212:25: note: in expansion of macro 'mbnchar' ksh-1.0.10/src/lib/libcmd/rev.c:82:41: note: in expansion of macro 'mbchar' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:212:25: note: in expansion of macro 'mbnchar' ksh-1.0.10/src/lib/libcmd/rev.c:82:41: note: in expansion of macro 'mbchar' ksh-1.0.10/arch/linux.i386-64/include/ast/ast.h:212:25: note: in expansion of macro 'mbnchar' ksh-1.0.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libsum/sumlib.c:150: included_from: Included from here. ksh-1.0.10/src/lib/libsum/sum-crc.c: scope_hint: In function 'crc_open' ksh-1.0.10/src/lib/libsum/sum-crc.c:135:26: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/src/lib/libsum/sum.h:28: included_from: Included from here. ksh-1.0.10/src/lib/libsum/sumlib.c:31: included_from: Included from here. ksh-1.0.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libsum/sum-crc.c:157:35: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/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.10/src/lib/libsum/sum-crc.c:157:71: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/src/lib/libsum/sum-crc.c:127:19: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libsum/sum-crc.c:156:26: note: in expansion of macro 'strneq' # 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.10/src/lib/libsum/sum-crc.c:159:35: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/src/lib/libsum/sum-crc.c:127:19: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libsum/sum-crc.c:158:26: note: in expansion of macro 'strneq' # 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.10/src/lib/libsum/sum-crc.c:159:71: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/src/lib/libsum/sum-crc.c:127:19: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libsum/sum-crc.c:156:26: note: in expansion of macro 'strneq' ksh-1.0.10/src/lib/libsum/sum-crc.c:158:26: note: in expansion of macro 'strneq' # 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.10/src/lib/libsum/sum-crc.c:161:37: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/src/lib/libsum/sum-crc.c:127:19: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libsum/sum-crc.c:156:26: note: in expansion of macro 'strneq' ksh-1.0.10/src/lib/libsum/sum-crc.c:158:26: note: in expansion of macro 'strneq' ksh-1.0.10/src/lib/libsum/sum-crc.c:160:26: note: in expansion of macro 'strneq' # 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.10/src/lib/libsum/sum-crc.c:164:38: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/src/lib/libsum/sum-crc.c:127:19: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libsum/sum-crc.c:156:26: note: in expansion of macro 'strneq' ksh-1.0.10/src/lib/libsum/sum-crc.c:158:26: note: in expansion of macro 'strneq' ksh-1.0.10/src/lib/libsum/sum-crc.c:160:26: note: in expansion of macro 'strneq' ksh-1.0.10/src/lib/libsum/sum-crc.c:162:26: note: in expansion of macro 'strneq' # 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.10/src/lib/libsum/sum-crc.c:171:16: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/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: GCC_ANALYZER_WARNING (CWE-476): ksh-1.0.10/src/lib/libsum/sumlib.c:151: included_from: Included from here. ksh-1.0.10/src/lib/libsum/sum-prng.c: scope_hint: In function 'prng_open' ksh-1.0.10/src/lib/libsum/sum-prng.c:71:34: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/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.10/src/lib/libsum/sum-prng.c:73:34: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/src/lib/libsum/sum-prng.c:58:19: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libsum/sum-prng.c:70:41: note: in expansion of macro 'strneq' ksh-1.0.10/src/lib/libsum/sum-prng.c:72:26: note: in expansion of macro 'strneq' # 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.10/src/lib/libsum/sum-prng.c:73:70: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/src/lib/libsum/sum-prng.c:58:19: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libsum/sum-prng.c:72:26: note: in expansion of macro 'strneq' # 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.10/src/lib/libsum/sum-prng.c:75:35: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/src/lib/libsum/sum-prng.c:58:19: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libsum/sum-prng.c:70:41: note: in expansion of macro 'strneq' ksh-1.0.10/src/lib/libsum/sum-prng.c:72:26: note: in expansion of macro 'strneq' ksh-1.0.10/src/lib/libsum/sum-prng.c:74:26: note: in expansion of macro 'strneq' # 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.10/src/lib/libsum/sum-prng.c:75:71: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/src/lib/libsum/sum-prng.c:58:19: note: in expansion of macro 'newof' ksh-1.0.10/src/lib/libsum/sum-prng.c:72:26: note: in expansion of macro 'strneq' ksh-1.0.10/src/lib/libsum/sum-prng.c:74:26: note: in expansion of macro 'strneq' # 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.10/src/lib/libsum/sum-prng.c:79:17: warning[-Wanalyzer-null-dereference]: dereference of NULL 'sum' ksh-1.0.10/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;