From 4242869ac1655787b0570570fd8b464ad0b4df8f Mon Sep 17 00:00:00 2001 From: Nik Date: Wed, 3 Jul 2024 22:48:15 +0200 Subject: [PATCH] patterns/zlib: Cast bitfield enums to integers before doing math with them --- patterns/zlib.hexpat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patterns/zlib.hexpat b/patterns/zlib.hexpat index 09cf96b..99dd9c4 100644 --- a/patterns/zlib.hexpat +++ b/patterns/zlib.hexpat @@ -47,11 +47,11 @@ bitfield Header { fn validate_hdr_checksum(Header hdr) { // Reassemble as a 2-byte big endian value u16 value = ( - (hdr.method << 8) + + (u8(hdr.method) << 8) + (hdr.info << 12) + (hdr.fcheck << 0) + (hdr.fdict << 5) + - (hdr.flevel << 6) + (u8(hdr.flevel) << 6) ); if (value % 31 == 0) {