Task #1866 - units-2.21-5.fc37/scan-results.err
back to task #1866download
Error: GCC_ANALYZER_WARNING (CWE-457): units-2.21/parse.tab.c: scope_hint: In function ‘unitsparse’ units-2.21/parse.tab.c:600:7: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘yyss’ units-2.21/parse.tab.c:585:9: note: in expansion of macro ‘YYCOPY’ units-2.21/parse.tab.c:1445:9: note: in expansion of macro ‘YYSTACK_RELOCATE’ units-2.21/parse.y:534:7: note: in expansion of macro ‘yyparse’ units-2.21/parse.tab.c:1312:1: note: in expansion of macro ‘yyparse’ units-2.21/parse.tab.c:585:9: note: in expansion of macro ‘YYCOPY’ units-2.21/parse.tab.c:1445:9: note: in expansion of macro ‘YYSTACK_RELOCATE’ units-2.21/parse.tab.c:585:9: note: in expansion of macro ‘YYCOPY’ units-2.21/parse.tab.c:1445:9: note: in expansion of macro ‘YYSTACK_RELOCATE’ # 598| # if defined __GNUC__ && 1 < __GNUC__ # 599| # define YYCOPY(Dst, Src, Count) \ # 600|-> __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # 601| # else # 602| # define YYCOPY(Dst, Src, Count) \ Error: GCC_ANALYZER_WARNING (CWE-401): units-2.21/units.c: scope_hint: In function ‘growbuffer’ units-2.21/units.c:382:10: warning[-Wanalyzer-malloc-leak]: leak of ‘buffer’ # 380| *bufsize += BUFGROW; # 381| if (usemalloc) # 382|-> *buf = malloc(*bufsize); # 383| else # 384| *buf = realloc(*buf,*bufsize); Error: GCC_ANALYZER_WARNING (CWE-401): units-2.21/units.c:384:10: warning[-Wanalyzer-malloc-leak]: leak of ‘buffer’ # 382| *buf = malloc(*bufsize); # 383| else # 384|-> *buf = realloc(*buf,*bufsize); # 385| if (!*buf){ # 386| fprintf(stderr, "%s: memory allocation error (growbuffer)\n",progname); Error: COMPILER_WARNING (CWE-563): units-2.21/units.c: scope_hint: In function ‘openfile’ units-2.21/units.c:396:7: warning[-Wunused-variable]: unused variable ‘ret’ # 396 | int ret; # | ^~~ # 394| { # 395| FILE *fileptr; # 396|-> int ret; # 397| # 398| struct stat statbuf; Error: CPPCHECK_WARNING (CWE-476): units-2.21/units.c:621: error[nullPointer]: Null pointer dereference # 619| len = strlen(str)+1; # 620| widestr = mymalloc(sizeof(wchar_t)*len, "(strwidth)"); # 621|-> len = mbsrtowcs(widestr, &str, len, NULL); # 622| # 623| if (len==-1){ Error: COMPILER_WARNING (CWE-563): units-2.21/units.c: scope_hint: In function ‘readunits’ units-2.21/units.c:804:41: warning[-Wunused-value]: value computed is not used # 804 | #define readerror (goterr=1) && errfile && fprintf # | ^~ units-2.21/units.c:1645:9: note: in expansion of macro ‘readerror’ # 1645 | readerror(errfile, "%s: %s on line %d of '%s'\n", # | ^~~~~~~~~ # 802| # 803| # 804|-> #define readerror (goterr=1) && errfile && fprintf # 805| # 806| #define VAGUE_ERR "%s: error in units file '%s' line %d\n", \ Error: CPPCHECK_WARNING (CWE-401): units-2.21/units.c:1408: error[memleakOnRealloc]: Common realloc mistake: 'tab' nulled but not freed upon failure # 1406| if (tabpt>=tablealloc){ # 1407| tablealloc+=20; # 1408|-> tab = (struct pair *)realloc(tab,sizeof(struct pair)*tablealloc); # 1409| if (!tab){ # 1410| if (errfile) fprintf(errfile, "%s: memory allocation error (newtable)\n", Error: CPPCHECK_WARNING (CWE-476): units-2.21/units.c:2376: error[ctunullpointer]: Null pointer dereference: first # 2374| { # 2375| return # 2376|-> compareproducts(first->numerator, second->numerator, isdimless) || # 2377| compareproducts(first->denominator, second->denominator, isdimless); # 2378| } Error: GCC_ANALYZER_WARNING (CWE-457): units-2.21/units.c: scope_hint: In function ‘showfunction’ units-2.21/units.c:2832:23: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘not_dimensionless’ # 2830| if (func->domain_min && func->domain_max) { # 2831| logprintf(num_format.format, *func->domain_min); # 2832|-> if (func->dimen && (not_dimensionless || unit.factor != 1)){ # 2833| if (isdecimal(*func->dimen)) # 2834| logputs(" *"); Error: GCC_ANALYZER_WARNING (CWE-457): units-2.21/units.c:2857:8: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘not_dimensionless’ # 2855| logputchar('\n'); # 2856| for(i=strwidth(deftext);i;i--) logputchar(' '); # 2857|-> if (not_dimensionless) # 2858| logprintf("%s has units %s",func->param, func->dimen); # 2859| else Error: COMPILER_WARNING (CWE-457): units-2.21/units.c: scope_hint: In function ‘showfunction’ units-2.21/units.c:2857:8: warning[-Wmaybe-uninitialized]: ‘not_dimensionless’ may be used uninitialized # 2857 | if (not_dimensionless) # | ^ units-2.21/units.c:2813:7: note: ‘not_dimensionless’ was declared here # 2813 | int not_dimensionless, i; # | ^~~~~~~~~~~~~~~~~ # 2855| logputchar('\n'); # 2856| for(i=strwidth(deftext);i;i--) logputchar(' '); # 2857|-> if (not_dimensionless) # 2858| logprintf("%s has units %s",func->param, func->dimen); # 2859| else Error: CPPCHECK_WARNING (CWE-457): units-2.21/units.c:3681: error[legacyUninitvar]: Uninitialized variable: indent # 3679| if (errors[i]) { # 3680| lastchar(unittext) = '0'+i; # 3681|-> printf("%s%s(",indent,infunc->name); # 3682| printf(num_format.format, factor); # 3683| printf("%s): %s\n", unittext, errormsg[errors[i]]); Error: COMPILER_WARNING (CWE-563): units-2.21/units.c: scope_hint: In function ‘checkcwd’ units-2.21/units.c:4131:9: warning[-Wunused-variable]: unused variable ‘p’ # 4131 | char *p; # | ^ # 4129| { # 4130| FILE *fp; # 4131|-> char *p; # 4132| # 4133| fp = openfile(file, "r"); Error: GCC_ANALYZER_WARNING (CWE-401): units-2.21/units.c: scope_hint: In function ‘getprogdir’ units-2.21/units.c:4279:10: warning[-Wanalyzer-malloc-leak]: leak of ‘progdir’ # 4277| *p = '\0'; # 4278| # 4279|-> return progdir; # 4280| } # 4281| Error: CPPCHECK_WARNING (CWE-672): units-2.21/units.c:4536: error[deallocret]: Returning/dereferencing 'file' after it is deallocated / released # 4534| else { # 4535| fclose(testfile); # 4536|-> return file; # 4537| } # 4538| } Error: COMPILER_WARNING (CWE-563): units-2.21/units.c: scope_hint: In function ‘printversion’ units-2.21/units.c:4749:9: warning[-Wunused-variable]: unused variable ‘fp’ # 4749 | FILE *fp, *histfile; # | ^~ # 4747| char *m_unitsfile; /* personal units data file from HOME_UNITS_ENV */ # 4748| char *p_unitsfile; /* personal units data file */ # 4749|-> FILE *fp, *histfile; # 4750| #ifdef _WIN32 # 4751| char *localemap; Error: CPPCHECK_WARNING (CWE-476): units-2.21/units.c:5558: warning[nullPointer]: Possible null pointer dereference: lastunitstr # 5556| if (!value_shown) { /* provide output if every value rounded to zero */ # 5557| logputs("0 "); # 5558|-> if (isdecimal(*lastunitstr)) # 5559| logputs("* "); # 5560| logputs(lastunitstr);