svn commit: r366075 - head/contrib/byacc
Alex Richardson
arichardson at FreeBSD.org
Wed Sep 23 12:54:44 UTC 2020
Author: arichardson
Date: Wed Sep 23 12:54:42 2020
New Revision: 366075
URL: https://svnweb.freebsd.org/changeset/base/366075
Log:
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
Modified:
head/contrib/byacc/closure.c
head/contrib/byacc/warshall.c
Modified: head/contrib/byacc/closure.c
==============================================================================
--- head/contrib/byacc/closure.c Wed Sep 23 12:54:37 2020 (r366074)
+++ head/contrib/byacc/closure.c Wed Sep 23 12:54:42 2020 (r366075)
@@ -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)
Modified: head/contrib/byacc/warshall.c
==============================================================================
--- head/contrib/byacc/warshall.c Wed Sep 23 12:54:37 2020 (r366074)
+++ head/contrib/byacc/warshall.c Wed Sep 23 12:54:42 2020 (r366075)
@@ -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;
More information about the svn-src-head
mailing list