byacc: fix UBSan signed shift range error
I've submitted this patch upstream, so apply this to contrib/ until a new version containing this change has been released. Reviewed By: jkim Differential Revision: https://reviews.freebsd.org/D26505
This commit is contained in:
parent
1e266857ad
commit
d1e106f262
@ -87,7 +87,7 @@ set_first_derives(void)
|
||||
k = 0;
|
||||
}
|
||||
|
||||
if (cword & (unsigned)(1 << k))
|
||||
if (cword & (1u << k))
|
||||
{
|
||||
rp = derives[j];
|
||||
while ((rule = *rp++) >= 0)
|
||||
@ -151,7 +151,7 @@ closure(Value_t *nucleus, int n)
|
||||
{
|
||||
for (i = 0; i < BITS_PER_WORD; ++i)
|
||||
{
|
||||
if (word & (unsigned)(1 << i))
|
||||
if (word & (1u << i))
|
||||
{
|
||||
itemno = rrhs[ruleno + i];
|
||||
while (csp < csend && *csp < itemno)
|
||||
|
@ -28,7 +28,7 @@ transitive_closure(unsigned *R, int n)
|
||||
|
||||
while (rowj < relend)
|
||||
{
|
||||
if (*ccol & (unsigned)(1 << i))
|
||||
if (*ccol & (1u << i))
|
||||
{
|
||||
rp = rowi;
|
||||
rend = rowj + rowsize;
|
||||
@ -70,7 +70,7 @@ reflexive_transitive_closure(unsigned *R, int n)
|
||||
rp = R;
|
||||
while (rp < relend)
|
||||
{
|
||||
*rp |= (unsigned)(1 << i);
|
||||
*rp |= (1u << i);
|
||||
if (++i >= BITS_PER_WORD)
|
||||
{
|
||||
i = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user