Fixed findings

List of Findings

Error: CPPCHECK_WARNING (CWE-628): [#def1]
espeak-ng-1.51.1/src/libespeak-ng/compiledata.c:1318: warning[invalidFunctionArg]: Invalid fputc() argument nr 1. The value is -128 but the valid values are '0:'.
# 1316|   			if (sample2 < -128)
# 1317|   				sample2 = -128;
# 1318|-> 			fputc(sample2, f_phdata);
# 1319|   		}
# 1320|   	}

Error: CPPCHECK_WARNING (CWE-457): [#def2]
espeak-ng-1.51.1/src/libespeak-ng/compiledata.c:1422: warning[uninitvar]: Uninitialized variable: env
# 1420|   
# 1421|   	displ = ftell(f_phdata);
# 1422|-> 	fwrite(env, 1, ENV_LEN, f_phdata);
# 1423|   
# 1424|   	return displ;

Error: CPPCHECK_WARNING (CWE-758): [#def3]
espeak-ng-1.51.1/src/libespeak-ng/compiledict.c:191: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#  189|   
#  190|   	for (ix = 8; ix < 64; ix++) {
#  191|-> 		if (((ix < 30) && (flags[0] & (1 << ix))) || ((ix >= 0x20) && (flags[1] & (1 << (ix-0x20))))) {
#  192|   			name = LookupMnemName(mnem_flags, ix);
#  193|   			len = strlen(name) + 1;

Error: CPPCHECK_WARNING (CWE-404): [#def4]
espeak-ng-1.51.1/src/libespeak-ng/synthdata.c:85: error[resourceLeak]: Resource leak: f_in
#   83|   	if (length == 0) {
#   84|   		*ptr = NULL;
#   85|-> 		return 0;
#   86|   	}
#   87|   

Error: CPPCHECK_WARNING (CWE-562): [#def5]
espeak-ng-1.51.1/src/libespeak-ng/translate.c:2498: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 2496|   	}
# 2497|   
# 2498|-> 	tr->clause_end = &sbuf[ix-1];
# 2499|   	sbuf[ix] = 0;
# 2500|   	words[0].pre_pause = 0; // don't add extra pause at beginning of clause

Error: CPPCHECK_WARNING (CWE-476): [#def6]
espeak-ng-1.51.1/src/libespeak-ng/voices.c:338: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: voice_data
#  336|   
#  337|   	memcpy(p, languages, langix);
#  338|-> 	voice_data->languages = p;
#  339|   
#  340|   	strcpy(&p[langix], fname);

Error: CPPCHECK_WARNING (CWE-476): [#def7]
espeak-ng-1.51.1/src/libespeak-ng/voices.c:341: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: voice_data
#  339|   
#  340|   	strcpy(&p[langix], fname);
#  341|-> 	voice_data->identifier = &p[langix];
#  342|   	voice_data->name = &p[langix];
#  343|   

Error: CPPCHECK_WARNING (CWE-476): [#def8]
espeak-ng-1.51.1/src/libespeak-ng/voices.c:342: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: voice_data
#  340|   	strcpy(&p[langix], fname);
#  341|   	voice_data->identifier = &p[langix];
#  342|-> 	voice_data->name = &p[langix];
#  343|   
#  344|   	if (vname[0] != 0) {

Error: CPPCHECK_WARNING (CWE-476): [#def9]
espeak-ng-1.51.1/src/libespeak-ng/voices.c:350: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: voice_data
#  348|   	}
#  349|   
#  350|-> 	voice_data->age = age;
#  351|   	voice_data->gender = gender;
#  352|   	voice_data->variant = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def10]
espeak-ng-1.51.1/src/libespeak-ng/voices.c:351: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: voice_data
#  349|   
#  350|   	voice_data->age = age;
#  351|-> 	voice_data->gender = gender;
#  352|   	voice_data->variant = 0;
#  353|   	voice_data->xx1 = n_variants;

Error: CPPCHECK_WARNING (CWE-476): [#def11]
espeak-ng-1.51.1/src/libespeak-ng/voices.c:352: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: voice_data
#  350|   	voice_data->age = age;
#  351|   	voice_data->gender = gender;
#  352|-> 	voice_data->variant = 0;
#  353|   	voice_data->xx1 = n_variants;
#  354|   	return voice_data;

Error: CPPCHECK_WARNING (CWE-476): [#def12]
espeak-ng-1.51.1/src/libespeak-ng/voices.c:353: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: voice_data
#  351|   	voice_data->gender = gender;
#  352|   	voice_data->variant = 0;
#  353|-> 	voice_data->xx1 = n_variants;
#  354|   	return voice_data;
#  355|   }

Scan Properties

analyzer-version-clippy1.90.0
analyzer-version-cppcheck2.18.3
analyzer-version-gcc15.2.1
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.90.0
diffbase-analyzer-version-cppcheck2.18.3
diffbase-analyzer-version-gcc15.2.1
diffbase-analyzer-version-gcc-analyzer16.0.0
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-14.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-gcc-latest-x86_64
diffbase-project-nameespeak-ng-1.51.1-12.fc44
diffbase-store-results-to/tmp/tmpp9w2gg01/espeak-ng-1.51.1-12.fc44.tar.xz
diffbase-time-created2025-10-28 17:53:17
diffbase-time-finished2025-10-28 17:55:38
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmpp9w2gg01/espeak-ng-1.51.1-12.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpp9w2gg01/espeak-ng-1.51.1-12.fc44.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-14.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-gcc-latest-x86_64
project-nameespeak-ng-1.51.1-11.fc43
store-results-to/tmp/tmprjanlrj2/espeak-ng-1.51.1-11.fc43.tar.xz
time-created2025-10-28 17:49:50
time-finished2025-10-28 17:52:47
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmprjanlrj2/espeak-ng-1.51.1-11.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmprjanlrj2/espeak-ng-1.51.1-11.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9