summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2012-01-15 13:54:23 +0900
committerNARUSE, Yui <naruse@airemix.jp>2012-01-15 13:54:23 +0900
commite4e5a2bf48028b92595f5625d6dfc7553c696053 (patch)
tree55b18bd7ccc31e09e4d40e2eacab0943cc44bfe9
parentb55b5cc8cb6c884a20f14d52bfd751dcaecb72af (diff)
downloadjson-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.c2
-rw-r--r--ext/json/ext/parser/parser.rl2
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)) {