diff options
author | NARUSE, Yui <naruse@airemix.jp> | 2012-01-15 13:54:23 +0900 |
---|---|---|
committer | NARUSE, Yui <naruse@airemix.jp> | 2012-01-15 13:54:23 +0900 |
commit | e4e5a2bf48028b92595f5625d6dfc7553c696053 (patch) | |
tree | 55b18bd7ccc31e09e4d40e2eacab0943cc44bfe9 | |
parent | b55b5cc8cb6c884a20f14d52bfd751dcaecb72af (diff) | |
download | json-e4e5a2bf48028b92595f5625d6dfc7553c696053.tar.gz |
The behavior of reference to inner defined variable is undefined.
https://bugs.ruby-lang.org/issues/5888
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51862
-rw-r--r-- | ext/json/ext/parser/parser.c | 2 | ||||
-rw-r--r-- | ext/json/ext/parser/parser.rl | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index c572a95..d4adb8e 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -1305,6 +1305,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd) { char *p = string, *pe = string, *unescape; int unescape_len; + char buf[4]; while (pe < stringEnd) { if (*pe == '\\') { @@ -1337,7 +1338,6 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd) if (pe > stringEnd - 4) { return Qnil; } else { - char buf[4]; UTF32 ch = unescape_unicode((unsigned char *) ++pe); pe += 3; if (UNI_SUR_HIGH_START == (ch & 0xFC00)) { diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index 5838dac..c96b0a8 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -405,6 +405,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd) { char *p = string, *pe = string, *unescape; int unescape_len; + char buf[4]; while (pe < stringEnd) { if (*pe == '\\') { @@ -437,7 +438,6 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd) if (pe > stringEnd - 4) { return Qnil; } else { - char buf[4]; UTF32 ch = unescape_unicode((unsigned char *) ++pe); pe += 3; if (UNI_SUR_HIGH_START == (ch & 0xFC00)) { |