Skip to content

Commit

Permalink
hashlib: prevent naive hashing of IdString when hashing SigBit
Browse files Browse the repository at this point in the history
  • Loading branch information
widlarizer committed Oct 30, 2024
1 parent df44003 commit 9bdecc5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/rtlil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9bdecc5

Please sign in to comment.