* [PATCH 1/2] Fix tokenizer for octal escape sequences
@ 2010-12-16 9:14 Namhyung Kim
2010-12-16 9:14 ` [PATCH 2/2] Update the validation check for " Namhyung Kim
2010-12-16 19:35 ` [PATCH 1/2] Fix tokenizer for octal " Christopher Li
0 siblings, 2 replies; 3+ messages in thread
From: Namhyung Kim @ 2010-12-16 9:14 UTC (permalink / raw)
To: Christopher Li; +Cc: linux-sparse
Don't allow 8 and 9 to be included in octal escape sequences.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
tokenize.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tokenize.c b/tokenize.c
index 4c975175eccc..272974b3b844 100644
--- a/tokenize.c
+++ b/tokenize.c
@@ -495,7 +495,7 @@ static int escapechar(int first, int type, stream_t *stream, int *valp)
case '0'...'7': {
int nr = 2;
value -= '0';
- while (next >= '0' && next <= '9') {
+ while (next >= '0' && next <= '7') {
value = (value << 3) + (next-'0');
next = nextchar(stream);
if (!--nr)
--
1.7.3.3.400.g93cef
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] Update the validation check for escape sequences
2010-12-16 9:14 [PATCH 1/2] Fix tokenizer for octal escape sequences Namhyung Kim
@ 2010-12-16 9:14 ` Namhyung Kim
2010-12-16 19:35 ` [PATCH 1/2] Fix tokenizer for octal " Christopher Li
1 sibling, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2010-12-16 9:14 UTC (permalink / raw)
To: Christopher Li; +Cc: linux-sparse
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
validation/escapes.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/validation/escapes.c b/validation/escapes.c
index b0d2b4b742c2..13f8f9c87e21 100644
--- a/validation/escapes.c
+++ b/validation/escapes.c
@@ -1,6 +1,21 @@
static int e[] = { '\'', '\"', '\?', '\\',
- '\a', '\b', '\f', '\n', '\r', '\t', '\v', };
-static char *s = "\'\"\?\\ \a\b\f\n\r\t\v";
+ '\a', '\b', '\f', '\n', '\r', '\t', '\v',
+ '\0', '\012', '\x7890', '\xabcd' };
+static char *s = "\'\"\?\\ \a\b\f\n\r\t\v \377\xcafe";
+
+static int bad_e[] = { '\c', '\0123', '\789', '\xdefg' };
/*
* check-name: Character escape sequences
+ *
+ * check-error-start
+escapes.c:6:27: warning: Unknown escape 'c'
+escapes.c:6:35: error: Bad character constant
+escapes.c:6:38: error: Bad character constant
+escapes.c:6:42: error: Bad character constant
+escapes.c:6:46: error: Bad character constant
+escapes.c:6:53: error: Bad character constant
+escapes.c:6:56: error: Bad character constant
+escapes.c:6:42: error: Expected } at end of initializer
+escapes.c:6:42: error: got 89
+ * check-error-end
*/
--
1.7.3.3.400.g93cef
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] Fix tokenizer for octal escape sequences
2010-12-16 9:14 [PATCH 1/2] Fix tokenizer for octal escape sequences Namhyung Kim
2010-12-16 9:14 ` [PATCH 2/2] Update the validation check for " Namhyung Kim
@ 2010-12-16 19:35 ` Christopher Li
1 sibling, 0 replies; 3+ messages in thread
From: Christopher Li @ 2010-12-16 19:35 UTC (permalink / raw)
To: Namhyung Kim; +Cc: linux-sparse
On Thu, Dec 16, 2010 at 1:14 AM, Namhyung Kim <namhyung@gmail.com> wrote:
> Don't allow 8 and 9 to be included in octal escape sequences.
> - while (next >= '0' && next <= '9') {
> + while (next >= '0' && next <= '7') {
Wow, good catch.
Thanks
Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-16 19:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-16 9:14 [PATCH 1/2] Fix tokenizer for octal escape sequences Namhyung Kim
2010-12-16 9:14 ` [PATCH 2/2] Update the validation check for " Namhyung Kim
2010-12-16 19:35 ` [PATCH 1/2] Fix tokenizer for octal " Christopher Li
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).