units-2.17-5.el8

List of Findings

Error: CPPCHECK_WARNING (CWE-476): [#def1]
units-2.17/units.c:552: error[nullPointer]: Null pointer dereference
#  550|     len = strlen(str)+1;
#  551|     widestr = mymalloc(sizeof(wchar_t)*len, "(strwidth)");
#  552|->   len = mbsrtowcs(widestr, &str, len, NULL);
#  553|   
#  554|     if (len==-1){

Error: COMPILER_WARNING (CWE-563): [#def2]
units-2.17/units.c: scope_hint: In function 'readunits'
units-2.17/units.c:735:41: warning[-Wunused-value]: value computed is not used
#  735 | #define readerror (goterr=1) && errfile && fprintf
#      |                                         ^~
units-2.17/units.c:1560:9: note: in expansion of macro 'readerror'
# 1560 |         readerror(errfile, "%s: %s on line %d of '%s'\n",
#      |         ^~~~~~~~~
#  733|   
#  734|   
#  735|-> #define readerror (goterr=1) && errfile && fprintf
#  736|   
#  737|   #define VAGUE_ERR "%s: error in units file '%s' line %d\n", \

Error: CPPCHECK_WARNING (CWE-401): [#def3]
units-2.17/units.c:1325: error[memleakOnRealloc]: Common realloc mistake: 'tab' nulled but not freed upon failure
# 1323|       if (tabpt>=tablealloc){
# 1324|         tablealloc+=20;
# 1325|->       tab = (struct pair *)realloc(tab,sizeof(struct pair)*tablealloc);
# 1326|         if (!tab){
# 1327|           if (errfile) fprintf(errfile, "%s: memory allocation error (newtable)\n",

Error: CPPCHECK_WARNING (CWE-476): [#def4]
units-2.17/units.c:2287: error[ctunullpointer]: Null pointer dereference: first
# 2285|   {
# 2286|      return
# 2287|->       compareproducts(first->numerator, second->numerator, isdimless) ||
# 2288|         compareproducts(first->denominator, second->denominator, isdimless);
# 2289|   }

Error: COMPILER_WARNING (CWE-457): [#def5]
units-2.17/units.c: scope_hint: In function 'showfunction'
units-2.17/units.c:2778:21: warning[-Wmaybe-uninitialized]: 'not_dimensionless' may be used uninitialized in this function
# 2778 |     if (func->dimen && (not_dimensionless || unit.factor != 1)){
#      |         ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 2776|         logprintf(num_format.format, *func->domain_min);
# 2777|       }
# 2778|->     if (func->dimen && (not_dimensionless || unit.factor != 1)){
# 2779|         if (isdecimal(*func->dimen))
# 2780|           logputs(" *");

Error: COMPILER_WARNING (CWE-563): [#def6]
units-2.17/units.c: scope_hint: In function 'checkcwd'
units-2.17/units.c:3862:9: warning[-Wunused-variable]: unused variable 'p'
# 3862 |   char *p;
#      |         ^
# 3860|   {
# 3861|     FILE *fp;
# 3862|->   char *p;
# 3863|   
# 3864|     fp = fopen(file, "r");

Error: CPPCHECK_WARNING (CWE-672): [#def7]
units-2.17/units.c:4222: error[deallocret]: Returning/dereferencing 'file' after it is deallocated / released
# 4220|     else {
# 4221|       fclose(testfile);
# 4222|->     return file;
# 4223|     }
# 4224|   }

Error: COMPILER_WARNING (CWE-563): [#def8]
units-2.17/units.c: scope_hint: In function 'printversion'
units-2.17/units.c:4394:21: warning[-Wunused-variable]: unused variable 'localemap'
# 4394 |   char *unitsfile, *localemap;
#      |                     ^~~~~~~~~
# 4392|   {
# 4393|     int exists;
# 4394|->   char *unitsfile, *localemap;
# 4395|   
# 4396|     if (flags.verbose == 0) {

Scan Properties

analyzer-version-clippy1.83.0
analyzer-version-cppcheck2.9
analyzer-version-gcc11.5.0
analyzer-version-gcc-analyzer11.5.0
analyzer-version-shellcheck0.8.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-187.us-west-2.compute.internal
mock-configcentos-stream+epel-9-x86_64
project-nameunits-2.17-5.el8
store-results-to/tmp/tmpjnx25iml/units-2.17-5.el8.tar.xz
time-created2025-01-30 08:47:44
time-finished2025-01-30 08:50:04
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'centos-stream+epel-9-x86_64' '-t' 'cppcheck,clippy,shellcheck,gcc,unicontrol' '-o' '/tmp/tmpjnx25iml/units-2.17-5.el8.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '/tmp/tmpjnx25iml/units-2.17-5.el8.src.rpm'
tool-versioncsmock-3.8.0-1.el9