mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-01-30 17:52:13 +01:00
fixes and workarounds for cppcheck 2.11 with uninitvar checks reactivated, and legacyUninitvar suppressed globally (as before):
src/internal.c:wolfSSL_DtlsUpdateWindow(): shiftTooManyBitsSigned and integerOverflowCond (true positive, fixed); src/ssl.c:wolfSSL_GetSessionFromCache(): autoVariables (true positive, intentional and now suppressed); wolfcrypt/src/asn.c: several uninitvars in EccSpecifiedECDomainDecode(), wc_EccPrivateKeyDecode(), DecodeSingleResponse(), and DecodeResponseData() (false positives due to bug in cppcheck short circuit eval analysis, mitigated by refactoring && expressions to nested-if constructs that are semantically identical); src/ssl.c:wolfSSL_GetSessionFromCache(): nullPointer (false positive due to bug in cppcheck value flow analysis, workarounded).
This commit is contained in:
@@ -16823,7 +16823,7 @@ int wolfSSL_DtlsUpdateWindow(word16 cur_hi, word32 cur_lo,
|
||||
diff %= DTLS_WORD_BITS;
|
||||
|
||||
if (idx < WOLFSSL_DTLS_WINDOW_WORDS)
|
||||
window[idx] |= (1 << diff);
|
||||
window[idx] |= (1U << diff);
|
||||
}
|
||||
else {
|
||||
_DtlsUpdateWindowGTSeq(diff + 1, window);
|
||||
|
||||
@@ -13684,7 +13684,8 @@ int wolfSSL_GetSessionFromCache(WOLFSSL* ssl, WOLFSSL_SESSION* output)
|
||||
#endif
|
||||
if (output->ticketLenAlloc)
|
||||
XFREE(output->ticket, output->heap, DYNAMIC_TYPE_SESSION_TICK);
|
||||
output->ticket = tmpTicket;
|
||||
output->ticket = tmpTicket; /* cppcheck-suppress autoVariables
|
||||
*/
|
||||
output->ticketLenAlloc = PREALLOC_SESSION_TICKET_LEN;
|
||||
output->ticketLen = 0;
|
||||
tmpBufSet = 1;
|
||||
@@ -13772,6 +13773,10 @@ int wolfSSL_GetSessionFromCache(WOLFSSL* ssl, WOLFSSL_SESSION* output)
|
||||
#endif /* HAVE_SESSION_TICKET && WOLFSSL_TLS13 */
|
||||
}
|
||||
|
||||
/* mollify confused cppcheck nullPointer warning. */
|
||||
if (sess == NULL)
|
||||
error = WOLFSSL_FAILURE;
|
||||
|
||||
if (error == WOLFSSL_SUCCESS) {
|
||||
#if defined(HAVE_SESSION_TICKET) && defined(WOLFSSL_TLS13)
|
||||
error = wolfSSL_DupSessionEx(sess, output, 1,
|
||||
|
||||
Reference in New Issue
Block a user