shithub: pc

Download patch

ref: 4d6118dcaca958f47209749457b4edcf4c680fe4
parent: 0ac845b70a399350109cadb5ec31b18cb35f2e6f
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Mon Mar 28 15:20:43 EDT 2022

please the sanitizers

--- a/libmp/dat.h
+++ b/libmp/dat.h
@@ -1,4 +1,4 @@
-#define	mpdighi  (mpdigit)(1<<(Dbits-1))
+#define	mpdighi  (mpdigit)(1U<<(Dbits-1))
 #define DIGITS(x) ((Dbits - 1 + (x))/Dbits)
 
 // for converting between int's and mpint's
--- a/libmp/mpdigdiv.c
+++ b/libmp/mpdigdiv.c
@@ -49,7 +49,7 @@
 			hi--;
 		lo -= y;
 		hi -= x;
-		q |= 1<<i;
+		q |= 1U<<i;
 	}
 	q += lo/divisor;
 	*quotient = q;
--- a/pc.y
+++ b/pc.y
@@ -640,7 +640,7 @@
 		yylval.sym = getsym(buf, 1);
 		return LSYMB;
 	}
-	if(c < 128 && (kw = optab[c], kw != nil)){
+	if(c >= 0 && c < 128 && (kw = optab[c], kw != nil)){
 		b = Bgetc(in);
 		for(; kw->name[0] == c; kw++)
 			if(kw->name[0] == b)