From 11ace7f8c2420630eaae599b631b3fe908b11848 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Mon, 26 Sep 2022 13:44:56 -0400 Subject: [PATCH] test: address coverity issue Coverity is reporting issues with negative returns. I think that is because size_t page = GetPageSize(); will always result in page being positive even if GetPageSize fails and returns -1 since size_t cannot be negative. This then would result n the check right afterwards not catching the failure. Fix by converting to size_t after we do the check. Signed-off-by: Michael Dawson --- test/cctest/test_crypto_clienthello.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/cctest/test_crypto_clienthello.cc b/test/cctest/test_crypto_clienthello.cc index 60a8e294c890a9..44ad3d658adb51 100644 --- a/test/cctest/test_crypto_clienthello.cc +++ b/test/cctest/test_crypto_clienthello.cc @@ -48,8 +48,9 @@ class OverrunGuardedBuffer { public: OverrunGuardedBuffer() { #if defined(USE_MPROTECT) || defined(USE_VIRTUALPROTECT) - size_t page = GetPageSize(); - EXPECT_GE(page, N); + int page_size_int = GetPageSize(); + EXPECT_GE(page_size_int, N); + size_t page = page_size_int; #endif #ifdef USE_MPROTECT // Place the packet right before a guard page, which, when accessed, causes