[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] grep: avoid nominal integer overflow
From: |
Paul Eggert |
Subject: |
[PATCH] grep: avoid nominal integer overflow |
Date: |
Sat, 10 Mar 2012 12:53:25 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120209 Thunderbird/10.0.1 |
* src/dfa.c (add_utf8_anychar): Avoid signed integer overflow.
Although this works on all platforms we know about, strictly
speaking the behavior is undefined, and Sun C 5.8 warns about it.
---
src/dfa.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/dfa.c b/src/dfa.c
index 2a69025..4f5eb96 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -1633,7 +1633,7 @@ add_utf8_anychar (void)
static const charclass utf8_classes[5] = {
{ 0, 0, 0, 0, ~0, ~0, 0, 0 }, /* 80-bf: non-lead bytes */
{ ~0, ~0, ~0, ~0, 0, 0, 0, 0 }, /* 00-7f: 1-byte sequence */
- { 0, 0, 0, 0, 0, 0, 0xfffffffcU, 0 }, /* c2-df: 2-byte sequence */
+ { 0, 0, 0, 0, 0, 0, ~3, 0 }, /* c2-df: 2-byte sequence */
{ 0, 0, 0, 0, 0, 0, 0, 0xffff }, /* e0-ef: 3-byte sequence */
{ 0, 0, 0, 0, 0, 0, 0, 0xff0000 } /* f0-f7: 4-byte sequence */
};
--
1.7.6.5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] grep: avoid nominal integer overflow,
Paul Eggert <=