fixes and suppressions for defects reported by clang-analyzer-unix.Stream (new in llvm-19.0.0_pre20240504):

* added POSIX definitions for XFEOF(), XFERROR(), and XCLEARERR(), currently with no-op fallbacks for !POSIX.
* added missing file handle checks in testsuite/testsuite.c:file_test() and tests/utils.h:copy_file().
* added fixes and suppression around tests/api.c:test_wolfSSL_SMIME_read_PKCS7().
* added various fixes in examples/asn1/asn1.c and examples/pem/pem.c.
This commit is contained in:
Daniel Pouzzner
2024-05-11 15:24:54 -05:00
parent cb689104d1
commit 9ac6bdd438
6 changed files with 58 additions and 4 deletions

View File

@@ -610,12 +610,19 @@ void file_test(const char* file, byte* check)
return;
}
while( ( i = (int)fread(buf, 1, sizeof(buf), f )) > 0 ) {
if (ferror(f)) {
printf("I/O error reading %s\n", file);
fclose(f);
return;
}
ret = wc_Sha256Update(&sha256, buf, i);
if (ret != 0) {
printf("Can't wc_Sha256Update %d\n", ret);
fclose(f);
return;
}
if (feof(f))
break;
}
ret = wc_Sha256Final(&sha256, shasum);