* [9front] [PATCH] cc: fix incorrect octal range condition in mpatov
@ 2022-01-23 1:05 Michael Forney
2022-01-23 15:16 ` ori
0 siblings, 1 reply; 2+ messages in thread
From: Michael Forney @ 2022-01-23 1:05 UTC (permalink / raw)
To: 9front
This does not have any adverse effect, since yylex never calls mpatov
with a string with leading 0 (and not 0x) that contains non-octal
digits, but the condition was wrong regardless.
---
diff 108d74cb0a8d27e82550d2772ae64fd7748e151d f101ca1299eb8d3ccafc9190651e98486948ec0d
--- a/sys/src/cmd/cc/lex.c Fri Jan 7 02:37:02 2022
+++ b/sys/src/cmd/cc/lex.c Sat Jan 22 17:05:27 2022
@@ -982,7 +982,7 @@
if(c == 'x' || c == 'X')
goto hex;
while(c = *s++) {
- if(c >= '0' || c <= '7')
+ if(c >= '0' && c <= '7')
nn = n*8 + c-'0';
else
goto bad;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [9front] [PATCH] cc: fix incorrect octal range condition in mpatov
2022-01-23 1:05 [9front] [PATCH] cc: fix incorrect octal range condition in mpatov Michael Forney
@ 2022-01-23 15:16 ` ori
0 siblings, 0 replies; 2+ messages in thread
From: ori @ 2022-01-23 15:16 UTC (permalink / raw)
To: 9front
Quoth Michael Forney <mforney@mforney.org>:
>
> This does not have any adverse effect, since yylex never calls mpatov
> with a string with leading 0 (and not 0x) that contains non-octal
> digits, but the condition was wrong regardless.
> ---
> diff 108d74cb0a8d27e82550d2772ae64fd7748e151d f101ca1299eb8d3ccafc9190651e98486948ec0d
> --- a/sys/src/cmd/cc/lex.c Fri Jan 7 02:37:02 2022
> +++ b/sys/src/cmd/cc/lex.c Sat Jan 22 17:05:27 2022
> @@ -982,7 +982,7 @@
> if(c == 'x' || c == 'X')
> goto hex;
> while(c = *s++) {
> - if(c >= '0' || c <= '7')
> + if(c >= '0' && c <= '7')
> nn = n*8 + c-'0';
> else
> goto bad;
>
applied, thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-23 16:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-23 1:05 [9front] [PATCH] cc: fix incorrect octal range condition in mpatov Michael Forney
2022-01-23 15:16 ` ori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).