69b49ac7ae (master): hash.c: avoid signed integer overflow in ar_hint_first_match SWAR splat

0 views
Skip to first unread message

Mrmaxmeier

unread,
Aug 28, 2026, 3:43:45 AM (4 days ago) Aug 28
to ruby...@g.ruby-lang.org
Mrmaxmeier 2026-08-26 23:00:15 +0000 (Wed, 26 Aug 2026)

New Revision: 69b49ac7ae

https://github.com/ruby/ruby/commit/69b49ac7ae

Log:
hash.c: avoid signed integer overflow in ar_hint_first_match SWAR splat

This was previously flagged by ubsan because the AR_HINT_BASE_MASK
constant is implicitly typed as long:

hash.c:664:43: runtime error: signed integer overflow: 72340172838076673
* 131 cannot be represented in type 'long'

Notably, in an unsigned context, this line can't overflow
(AR_HINT_BASE_MASK is 0x0101..0101). VALUE is always an unsigned type
Reply all
Reply to author
Forward
0 new messages