From 2f051a681b17b903808fb53ab9ab0e498c8af354 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Mon, 5 Apr 2021 18:32:03 +0200 Subject: [PATCH] cppcheck: Suprocess warnings of type "objectIndex" Report from Cppcheck 2.4.1 was: lib/xmlparse.c:729:26: warning: The address of local variable 'entropy' might be accessed at non-zero index. [objectIndex] ((uint8_t *)target)[bytesWrittenTotal] = random8; ^ lib/xmlparse.c:820:39: note: Address of variable taken here. writeRandomBytes_arc4random((void *)&entropy, sizeof(entropy)); ^ lib/xmlparse.c:820:31: note: Calling function 'writeRandomBytes_arc4random', 1st argument '(void*)&entropy' value is lifetime=entropy writeRandomBytes_arc4random((void *)&entropy, sizeof(entropy)); ^ lib/xmlparse.c:729:26: note: The address of local variable 'entropy' might be accessed at non-zero index. ((uint8_t *)target)[bytesWrittenTotal] = random8; ^ lib/xmltok.c:318:54: error: The address of local variable 'fromLim' is accessed at non-zero index. [objectIndex] const unsigned char prev = (unsigned char)fromLim[-1]; ^ lib/xmltok.c:369:56: note: Address of variable taken here. _INTERNAL_trim_to_complete_utf8_characters(*fromP, &fromLim); ^ lib/xmltok.c:369:56: note: Calling function '_INTERNAL_trim_to_complete_utf8_characters', 2nd argument '&fromLim' value is lifetime=fromLim _INTERNAL_trim_to_complete_utf8_characters(*fromP, &fromLim); ^ lib/xmltok.c:318:54: note: The address of local variable 'fromLim' is accessed at non-zero index. const unsigned char prev = (unsigned char)fromLim[-1]; ^ --- .travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index 06d98d09..c9e57d01 100755 --- a/.travis.sh +++ b/.travis.sh @@ -70,7 +70,7 @@ elif [[ ${MODE} = cppcheck ]]; then -name xmltok_ns.c -o -name xmltok_impl.c \) - -exec cppcheck --quiet --error-exitcode=1 --force {} + + -exec cppcheck --quiet --error-exitcode=1 --force --suppress=objectIndex {} + ) find "${find_args[@]}" elif [[ ${MODE} = clang-format ]]; then