From dc7070b71ffa135e669d764b22afefdc4276267c Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Wed, 30 Oct 2024 11:48:54 +0100 Subject: [PATCH] hashlib: prevent naive hashing of IdString when hashing SigBit --- kernel/rtlil.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/rtlil.h b/kernel/rtlil.h index bd3e4c92b..3c793453a 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -1819,8 +1819,10 @@ inline bool RTLIL::SigBit::operator!=(const RTLIL::SigBit &other) const { inline Hasher RTLIL::SigBit::hash_acc(Hasher h) const { if (wire) { - h = wire->name.hash_acc(h); h.acc(offset); + // hash_acc isn't allowed to come first, or it might hash trivially + // and possibly ruin things + h = wire->name.hash_acc(h); return h; } h.acc(data);