diff --git a/.clang-tidy b/.clang-tidy index a622fae5..b3a50607 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -7,9 +7,11 @@ Checks: > bugprone-*, -bugprone-assignment-in-if-condition, -bugprone-branch-clone, + -bugprone-casting-through-void, -bugprone-easily-swappable-parameters, -bugprone-empty-catch, -bugprone-implicit-widening-of-multiplication-result, + -bugprone-inc-dec-in-conditions, -bugprone-macro-parentheses, -bugprone-narrowing-conversions, -bugprone-reserved-identifier, @@ -25,6 +27,7 @@ Checks: > clang-diagnostic-*, performance-*, -performance-avoid-endl, + -performance-enum-size, -performance-unnecessary-value-param, FormatStyle: file HeaderFilterRegex: '.*' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91a1ad4a..1d78f2f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,17 +87,19 @@ jobs: if: ${{ matrix.use_extra }} run: | sudo dpkg --add-architecture i386 - sudo apt-get update + sudo apt-get update && sudo apt-get upgrade -y sudo apt-get install -y g++-multilib g++-mingw-w64-i686 g++-mingw-w64-x86-64 # make sure that we use posix-threads (pthread/winpthreads) and NOT win32-threads for f in i686-w64-mingw32-g++ i686-w64-mingw32-gcc x86_64-w64-mingw32-g++ x86_64-w64-mingw32-gcc; do if test -f /usr/bin/$f-posix; then sudo update-alternatives --set $f /usr/bin/$f-posix; fi + ls -l /usr/bin/${f}* done + ls -l /etc/alternatives/*mingw* || true sudo apt-get install -y libc6-dbg:i386 valgrind - name: Install Wine if: ${{ matrix.use_extra && matrix.use_wine }} run: | - sudo apt-get install -y wine wine32 wine64 + sudo apt-get install -y wine wine32:i386 wine64 ls -l /usr/bin/wine* mkdir -p -v ~/.wine && wineboot --init - uses: actions/checkout@v4 diff --git a/misc/analyze/clang-tidy/clang-tidy-ucl.yml b/misc/analyze/clang-tidy/clang-tidy-ucl.yml index 19de2e0b..b63b43fc 100644 --- a/misc/analyze/clang-tidy/clang-tidy-ucl.yml +++ b/misc/analyze/clang-tidy/clang-tidy-ucl.yml @@ -6,8 +6,10 @@ Checks: > -*, bugprone-*, -bugprone-assignment-in-if-condition, + -bugprone-casting-through-void, -bugprone-easily-swappable-parameters, -bugprone-implicit-widening-of-multiplication-result, + -bugprone-inc-dec-in-conditions, -bugprone-macro-parentheses, -bugprone-reserved-identifier, -bugprone-sizeof-expression, diff --git a/misc/analyze/clang-tidy/clang-tidy-zlib.yml b/misc/analyze/clang-tidy/clang-tidy-zlib.yml index 53773540..7d2d2458 100644 --- a/misc/analyze/clang-tidy/clang-tidy-zlib.yml +++ b/misc/analyze/clang-tidy/clang-tidy-zlib.yml @@ -8,6 +8,7 @@ Checks: > -bugprone-assignment-in-if-condition, -bugprone-easily-swappable-parameters, -bugprone-implicit-widening-of-multiplication-result, + -bugprone-inc-dec-in-conditions, -bugprone-macro-parentheses, -bugprone-narrowing-conversions, -bugprone-reserved-identifier, diff --git a/misc/analyze/clang-tidy/clang-tidy-zstd.yml b/misc/analyze/clang-tidy/clang-tidy-zstd.yml index 91348b75..04649c80 100644 --- a/misc/analyze/clang-tidy/clang-tidy-zstd.yml +++ b/misc/analyze/clang-tidy/clang-tidy-zstd.yml @@ -7,6 +7,7 @@ Checks: > bugprone-*, -bugprone-assignment-in-if-condition, -bugprone-branch-clone, + -bugprone-casting-through-void, -bugprone-easily-swappable-parameters, -bugprone-implicit-widening-of-multiplication-result, -bugprone-macro-parentheses, diff --git a/misc/make/Makefile-extra.mk b/misc/make/Makefile-extra.mk index 2db8f618..b09aee33 100644 --- a/misc/make/Makefile-extra.mk +++ b/misc/make/Makefile-extra.mk @@ -6,15 +6,30 @@ ifeq ($(UPX_MAKEFILE_EXTRA_MK_INCLUDED),) override UPX_MAKEFILE_EXTRA_MK_INCLUDED := 1 +#*********************************************************************** +# support functions +#*********************************************************************** + override check_defined = $(foreach 1,$1,$(if $(filter undefined,$(origin $1)),$(error ERROR: variable '$1' is not defined),)) override check_undefined = $(foreach 1,$1,$(if $(filter undefined,$(origin $1)),,$(error ERROR: variable '$1' is already defined))) -$(call check_defined,run_config run_build) -$(call check_undefined,run_config_and_build) + +# return "1" or empty-string +override eq = $(if $(subst x$1,,x$2)$(subst x$2,,x$1),,1) +override ne = $(if $(subst x$1,,x$2)$(subst x$2,,x$1),1,) + +override tolower = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1)))))))))))))))))))))))))) +override toupper = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1)))))))))))))))))))))))))) + +# canonicalize case of CMAKE_BUILD_TYPE to "Debug" and "Release" +override cm_build_type = $(if $(call eq,$1,),$(error EMPTY-build-type),$(if $(call eq,$(call tolower,$1),debug),Debug,$(if $(call eq,$(call tolower,$1),release),Release,$(if $(call eq,$(call tolower,$1),none),None,$1)))) #*********************************************************************** # extra builds: some pre-defined build configurations #*********************************************************************** +$(call check_defined,run_config run_build) +$(call check_undefined,run_config_and_build) + define run_config_and_build $(call run_config,$1,$2) $(call run_build,$1,$2) @@ -168,7 +183,7 @@ build/extra/cross-windows-mingw64/%: export CC = x86_64-w64-mingw32-gcc -static build/extra/cross-windows-mingw64/%: export CXX = x86_64-w64-mingw32-g++ -static -D_WIN32_WINNT=0x0501 build/extra/cross-windows-mingw64/%: CMAKE_SYSTEM_NAME ?= Windows build/extra/cross-windows-mingw64/%: CMAKE_SYSTEM_PROCESSOR ?= AMD64 -build/extra/cross-windows-mingw64/%: CMAKE_CROSSCOMPILING_EMULATOR ?= wine64 +build/extra/cross-windows-mingw64/%: CMAKE_CROSSCOMPILING_EMULATOR ?= wine # cross compiler: macOS arm64 (aarch64) build/extra/cross-darwin-arm64/debug: PHONY; $(call run_config_and_build,$@,Debug) @@ -198,19 +213,20 @@ build/analyze/clang-analyzer/%: override CMAKE := $(SCAN_BUILD) $(CMAKE) build/analyze/clang-analyzer/%: export CCC_CC ?= clang build/analyze/clang-analyzer/%: export CCC_CXX ?= clang++ -# run clang-tidy: uses file compile_commands.json from an existing clang build -# does not create any actual files, so purely PHONY +# run clang-tidy: uses file compile_commands.json from an existing clang build; +# does not create any actual files, so purely PHONY +CLANG_TIDY_BUILD_BASE = build/extra/clang RUN_CLANG_TIDY = time python3 ./misc/analyze/clang-tidy/run-clang-tidy.py -p $< RUN_CLANG_TIDY_WERROR = $(RUN_CLANG_TIDY) '-warnings-as-errors=*' -build/analyze/clang-tidy-upx/debug build/analyze/clang-tidy-upx/release: build/extra/clang/$$(notdir $$@) PHONY +build/analyze/clang-tidy-upx/debug build/analyze/clang-tidy-upx/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY $(RUN_CLANG_TIDY_WERROR) -config-file ./.clang-tidy '/src/.*\.cpp' -build/analyze/clang-tidy-bzip2/debug build/analyze/clang-tidy-bzip2/release: build/extra/clang/$$(notdir $$@) PHONY +build/analyze/clang-tidy-bzip2/debug build/analyze/clang-tidy-bzip2/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY $(RUN_CLANG_TIDY) -config-file ./misc/analyze/clang-tidy/clang-tidy-bzip2.yml /vendor/bzip2/ -build/analyze/clang-tidy-ucl/debug build/analyze/clang-tidy-ucl/release: build/extra/clang/$$(notdir $$@) PHONY +build/analyze/clang-tidy-ucl/debug build/analyze/clang-tidy-ucl/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY $(RUN_CLANG_TIDY_WERROR) -config-file ./misc/analyze/clang-tidy/clang-tidy-ucl.yml /vendor/ucl/ -build/analyze/clang-tidy-zlib/debug build/analyze/clang-tidy-zlib/release: build/extra/clang/$$(notdir $$@) PHONY +build/analyze/clang-tidy-zlib/debug build/analyze/clang-tidy-zlib/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY $(RUN_CLANG_TIDY_WERROR) -config-file ./misc/analyze/clang-tidy/clang-tidy-zlib.yml /vendor/zlib/ -build/analyze/clang-tidy-zstd/debug build/analyze/clang-tidy-zstd/release: build/extra/clang/$$(notdir $$@) PHONY +build/analyze/clang-tidy-zstd/debug build/analyze/clang-tidy-zstd/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY $(RUN_CLANG_TIDY) -config-file ./misc/analyze/clang-tidy/clang-tidy-zstd.yml /vendor/zstd/ build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-upx/$$(notdir $$@) build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-bzip2/$$(notdir $$@) diff --git a/src/linker.cpp b/src/linker.cpp index 4918f2f2..6c3263da 100644 --- a/src/linker.cpp +++ b/src/linker.cpp @@ -40,16 +40,18 @@ static bool update_capacity(unsigned size, unsigned *capacity) { return true; } -static void internal_error(const char *format, ...) attribute_format(1, 2); -static void internal_error(const char *format, ...) { - static char buf[1024]; - va_list ap; +template +static noinline T **realloc_array(T **array, size_t capacity) { + // NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion) + void *p = realloc(array, mem_size(sizeof(T *), capacity)); + return static_cast(p); +} - va_start(ap, format); - upx_safe_vsnprintf(buf, sizeof(buf), format, ap); - va_end(ap); - - throwInternalError(buf); +template +static noinline void free_array(T **array, size_t count) { + for (size_t i = 0; i < count; i++) + delete array[i]; + ::free(array); // NOLINT(bugprone-multi-level-implicit-pointer-conversion) } /************************************************************************* @@ -106,17 +108,9 @@ ElfLinker::ElfLinker(const N_BELE_RTP::AbstractPolicy *b) noexcept : bele(b) {} ElfLinker::~ElfLinker() noexcept { delete[] input; delete[] output; - - unsigned ic; - for (ic = 0; ic < nsections; ic++) - delete sections[ic]; - ::free(sections); - for (ic = 0; ic < nsymbols; ic++) - delete symbols[ic]; - ::free(symbols); - for (ic = 0; ic < nrelocations; ic++) - delete relocations[ic]; - ::free(relocations); + free_array(sections, nsections); + free_array(symbols, nsymbols); + free_array(relocations, nrelocations); } void ElfLinker::init(const void *pdata_v, int plen, unsigned pxtra) { @@ -302,7 +296,7 @@ ElfLinker::Section *ElfLinker::findSection(const char *name, bool fatal) const { if (strcmp(sections[ic]->name, name) == 0) return sections[ic]; if (fatal) - internal_error("unknown section %s\n", name); + throwInternalError("unknown section %s\n", name); return nullptr; } @@ -311,7 +305,7 @@ ElfLinker::Symbol *ElfLinker::findSymbol(const char *name, bool fatal) const { if (strcmp(symbols[ic]->name, name) == 0) return symbols[ic]; if (fatal) - internal_error("unknown symbol %s\n", name); + throwInternalError("unknown symbol %s\n", name); return nullptr; } @@ -321,8 +315,7 @@ ElfLinker::Section *ElfLinker::addSection(const char *sname, const void *sdata, if (!sdata && (!strcmp("ABS*", sname) || !strcmp("UND*", sname))) return nullptr; if (update_capacity(nsections, &nsections_capacity)) - sections = - static_cast
(realloc(sections, nsections_capacity * sizeof(Section *))); + sections = realloc_array(sections, nsections_capacity); assert(sections); assert(sname); assert(sname[0]); @@ -338,7 +331,7 @@ ElfLinker::Symbol *ElfLinker::addSymbol(const char *name, const char *section, upx_uint64_t offset) { NO_printf("addSymbol: %s %s 0x%llx\n", name, section, offset); if (update_capacity(nsymbols, &nsymbols_capacity)) - symbols = static_cast(realloc(symbols, nsymbols_capacity * sizeof(Symbol *))); + symbols = realloc_array(symbols, nsymbols_capacity); assert(symbols != nullptr); assert(name); assert(name[0]); @@ -352,8 +345,7 @@ ElfLinker::Symbol *ElfLinker::addSymbol(const char *name, const char *section, ElfLinker::Relocation *ElfLinker::addRelocation(const char *section, unsigned off, const char *type, const char *symbol, upx_uint64_t add) { if (update_capacity(nrelocations, &nrelocations_capacity)) - relocations = static_cast( - realloc(relocations, (nrelocations_capacity) * sizeof(Relocation *))); + relocations = realloc_array(relocations, nrelocations_capacity); assert(relocations != nullptr); Relocation *rel = new Relocation(findSection(section), off, type, findSymbol(symbol), add); relocations[nrelocations++] = rel; @@ -361,9 +353,8 @@ ElfLinker::Relocation *ElfLinker::addRelocation(const char *section, unsigned of } #if 0 -void ElfLinker::setLoaderAlignOffset(int phase) -{ - //assert(phase & 0); +void ElfLinker::setLoaderAlignOffset(int phase) { + // assert(phase & 0); NO_printf("\nFIXME: ElfLinker::setLoaderAlignOffset %d\n", phase); } #endif @@ -474,10 +465,10 @@ void ElfLinker::relocate() { value = rel->value->offset; } else if (strcmp(rel->value->section->name, "*UND*") == 0 && rel->value->offset == 0xdeaddead) - internal_error("undefined symbol '%s' referenced\n", rel->value->name); + throwInternalError("undefined symbol '%s' referenced\n", rel->value->name); else if (rel->value->section->output == nullptr) - internal_error("can not apply reloc '%s:%x' without section '%s'\n", rel->section->name, - rel->offset, rel->value->section->name); + throwInternalError("can not apply reloc '%s:%x' without section '%s'\n", + rel->section->name, rel->offset, rel->value->section->name); else { value = rel->value->section->offset + rel->value->offset + rel->add; } @@ -495,7 +486,7 @@ void ElfLinker::relocate() { void ElfLinker::defineSymbol(const char *name, upx_uint64_t value) { Symbol *symbol = findSymbol(name); if (strcmp(symbol->section->name, "*ABS*") == 0) - internal_error("defineSymbol: symbol '%s' is *ABS*\n", name); + throwInternalError("defineSymbol: symbol '%s' is *ABS*\n", name); else if (strcmp(symbol->section->name, "*UND*") == 0) // for undefined symbols symbol->offset = value; else if (strcmp(symbol->section->name, name) == 0) // for sections @@ -506,7 +497,7 @@ void ElfLinker::defineSymbol(const char *name, upx_uint64_t value) { value += section->size; } } else - internal_error("defineSymbol: symbol '%s' already defined\n", name); + throwInternalError("defineSymbol: symbol '%s' already defined\n", name); } // debugging support @@ -553,7 +544,7 @@ void ElfLinker::alignWithByte(unsigned len, byte b) { } void ElfLinker::relocate1(const Relocation *rel, byte *, upx_uint64_t, const char *) { - internal_error("unknown relocation type '%s\n'", rel->type); + throwInternalError("unknown relocation type '%s\n'", rel->type); } /************************************************************************* @@ -563,14 +554,13 @@ void ElfLinker::relocate1(const Relocation *rel, byte *, upx_uint64_t, const cha **************************************************************************/ #if 0 // FIXME -static void check8(const Relocation *rel, const byte *location, int v, int d) -{ +static void check8(const Relocation *rel, const byte *location, int v, int d) { if (v < -128 || v > 127) - internal_error("value out of range (%d) in reloc %s:%x\n", - v, rel->section->name, rel->offset); + throwInternalError("value out of range (%d) in reloc %s:%x\n", v, rel->section->name, + rel->offset); if (d < -128 || d > 127) - internal_error("displacement target out of range (%d) in reloc %s:%x\n", - v, rel->section->name, rel->offset); + throwInternalError("displacement target out of range (%d) in reloc %s:%x\n", v, + rel->section->name, rel->offset); } #endif @@ -594,8 +584,8 @@ void ElfLinkerAMD64::relocate1(const Relocation *rel, byte *location, upx_uint64 if (strcmp(type, "8") == 0) { int displ = (upx_int8_t) *location + (int) value; if (range_check && (displ < -128 || displ > 127)) - internal_error("target out of range (%d) in reloc %s:%x\n", displ, rel->section->name, - rel->offset); + throwInternalError("target out of range (%d) in reloc %s:%x\n", displ, + rel->section->name, rel->offset); *location += value; } else if (strcmp(type, "16") == 0) set_le16(location, get_le16(location) + value); @@ -800,12 +790,12 @@ void ElfLinkerPpc32::relocate1(const Relocation *rel, byte *location, upx_uint64 // Note that original (*location).displ is ignored. if (strcmp(type, "24") == 0) { if (3 & value) - internal_error("unaligned word displacement"); + throwInternalError("unaligned word displacement"); // FIXME: displacement overflow? set_be32(location, (0xfc000003 & get_be32(location)) + (0x03fffffc & value)); } else if (strcmp(type, "14") == 0) { if (3 & value) - internal_error("unaligned word displacement"); + throwInternalError("unaligned word displacement"); // FIXME: displacement overflow? set_be32(location, (0xffff0003 & get_be32(location)) + (0x0000fffc & value)); } else @@ -837,19 +827,19 @@ void ElfLinkerPpc64le::relocate1(const Relocation *rel, byte *location, upx_uint if (strncmp(type, "14", 2) == 0) { // for "14" and "14S" if (3 & value) - internal_error("unaligned word displacement"); + throwInternalError("unaligned word displacement"); // FIXME: displacement overflow? set_le32(location, (0xffff0003 & get_le32(location)) + (0x0000fffc & value)); } else if (strncmp(type, "24", 2) == 0) { // for "24" and "24S" if (3 & value) - internal_error("unaligned word displacement"); + throwInternalError("unaligned word displacement"); // FIXME: displacement overflow? set_le32(location, (0xfc000003 & get_le32(location)) + (0x03fffffc & value)); } else if (strcmp(type, "8") == 0) { int displ = (upx_int8_t) *location + (int) value; if (range_check && (displ < -128 || displ > 127)) - internal_error("target out of range (%d) in reloc %s:%x\n", displ, rel->section->name, - rel->offset); + throwInternalError("target out of range (%d) in reloc %s:%x\n", displ, + rel->section->name, rel->offset); *location += value; } else if (strcmp(type, "16") == 0) set_le16(location, get_le16(location) + value); @@ -887,19 +877,19 @@ void ElfLinkerPpc64::relocate1(const Relocation *rel, byte *location, upx_uint64 if (strncmp(type, "14", 2) == 0) { // for "14" and "14S" if (3 & value) - internal_error("unaligned word displacement"); + throwInternalError("unaligned word displacement"); // FIXME: displacement overflow? set_be32(location, (0xffff0003 & get_be32(location)) + (0x0000fffc & value)); } else if (strncmp(type, "24", 2) == 0) { // for "24" and "24S" if (3 & value) - internal_error("unaligned word displacement"); + throwInternalError("unaligned word displacement"); // FIXME: displacement overflow? set_be32(location, (0xfc000003 & get_be32(location)) + (0x03fffffc & value)); } else if (strcmp(type, "8") == 0) { int displ = (upx_int8_t) *location + (int) value; if (range_check && (displ < -128 || displ > 127)) - internal_error("target out of range (%d) in reloc %s:%x\n", displ, rel->section->name, - rel->offset); + throwInternalError("target out of range (%d) in reloc %s:%x\n", displ, + rel->section->name, rel->offset); *location += value; } else if (strcmp(type, "16") == 0) set_be16(location, get_be16(location) + value); @@ -927,8 +917,8 @@ void ElfLinkerX86::relocate1(const Relocation *rel, byte *location, upx_uint64_t if (strcmp(type, "8") == 0) { int displ = (upx_int8_t) *location + (int) value; if (range_check && (displ < -128 || displ > 127)) - internal_error("target out of range (%d,%d,%llu) in reloc %s:%x\n", displ, *location, - value, rel->section->name, rel->offset); + throwInternalError("target out of range (%d,%d,%llu) in reloc %s:%x\n", displ, + *location, value, rel->section->name, rel->offset); *location += value; } else if (strcmp(type, "16") == 0) set_le16(location, get_le16(location) + value); diff --git a/src/main.cpp b/src/main.cpp index 66b7f790..4e9f2ccb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1116,7 +1116,7 @@ void main_get_envoptions() { if (targc > 1) targv = (const char **) upx_calloc(targc + 1, sizeof(char *)); if (targv == nullptr) { - free(env); + ::free(env); return; } @@ -1155,8 +1155,8 @@ void main_get_envoptions() { e_envopt(targv[mfx_optind]); /* clean up */ - free(targv); - free(env); + ::free(targv); // NOLINT(bugprone-multi-level-implicit-pointer-conversion) + ::free(env); #endif /* defined(OPTIONS_VAR) */ } diff --git a/src/pefile.cpp b/src/pefile.cpp index 24e8d560..4df6be30 100644 --- a/src/pefile.cpp +++ b/src/pefile.cpp @@ -859,6 +859,7 @@ public: outputlen = 0; // sort the sections by name before adding them all + // NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion) upx_qsort(sections, nsections, sizeof(Section *), ImportLinker::compare); for (unsigned ic = 0; ic < nsections; ic++) @@ -1041,6 +1042,7 @@ unsigned PeFile::processImports0(ord_mask_t ord_mask) // pass 1 mb_oimport.clear(); oimport = mb_oimport; + // NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion) upx_qsort(idlls, dllnum, sizeof(*idlls), UDll::compare); info("Processing imports: %d DLLs", dllnum); diff --git a/src/util/util.h b/src/util/util.h index 6251cdfc..5c34a1ec 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -77,7 +77,7 @@ T *NewArray(upx_uint64_t n) may_throw { T *array = new T[size_t(n)]; #if !defined(__SANITIZE_MEMORY__) if (array != nullptr && bytes > 0) { - memset(array, 0xfb, bytes); + memset(array, 0xfb, bytes); // NOLINT(bugprone-multi-level-implicit-pointer-conversion) (void) VALGRIND_MAKE_MEM_UNDEFINED(array, bytes); } #endif