An unsigned overflow in luai_makeseed()

Sergey Bronnikov <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
Hello,

the function luai_makeseed() in lauxlib.c has the following expression [1]:

res ^= (res >> 3) + (res << 7) + buff[i];

where res has type "unsigned integer". This arithmetic has an unsigned 
overflow.
This is of course undefined behavior from a language point of view, but 
maybe it is used here intentionally?

1. https://github.com/lua/lua/blob/c6b484823806e08e1756b1a6066a3ace6f080fae/lauxlib.c#L1167

Sergey

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/c36ec376-99a3-4869-9881-46eb9dde1a6cn%40googlegroups.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.