From: Konstantinos Margaritis Date: Sat, 18 May 2024 11:58:11 +0000 (+0300) Subject: Fix casts X-Git-Tag: vectorscan/5.4.12^2~35^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06339e65adfceafe70755c454c70af588da5fd83;p=thirdparty%2Fvectorscan.git Fix casts --- diff --git a/src/nfa/castlecompile.cpp b/src/nfa/castlecompile.cpp index 28f1aed9..115646da 100644 --- a/src/nfa/castlecompile.cpp +++ b/src/nfa/castlecompile.cpp @@ -632,11 +632,12 @@ buildCastle(const CastleProto &proto, if (patchSize[i]) { RepeatInfo *info = reinterpret_cast(ptr); - u64a *table = reinterpret_cast(ROUNDUP_PTR(info + + char *info_base = reinterpret_cast(info); + u64a *table = reinterpret_cast(ROUNDUP_PTR(info_base + sizeof(*info), alignof(u64a))); copy(tables.begin() + tableIdx, tables.begin() + tableIdx + patchSize[i], table); - u32 diff = reinterpret_cast(table) - reinterpret_cast(info) + + u32 diff = reinterpret_cast(table) - info_base + sizeof(u64a) * patchSize[i]; info->length = diff; length += diff;