lua-users home
lua-l archive

Re: clang memory sanitizer report unsigned int overflow

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> For reference that is this line marked with **:
> 
> | unsigned int luaS_hash (const char *str, size_t l, unsigned int seed)
> {
> | unsigned int h = seed ^ cast_uint(l);
> | for (; l > 0; l--)
> **| h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1]));
> | return h;
> | }
> 
> Though not sure which part of that would be causing an add overflow because
> h is an unsigned int which I believe should not trigger UB when it
> overflows.
The 'reason' itself states "Unsigned integer overflow", which does not
exist in ISO C...
 Process 626150 stopped
 * thread #1, name = 'ufsrv', stop reason = Unsigned integer overflow
 ??????????????????????????????????
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /