Commit c2a6ff7a authored by Takashi Sogabe's avatar Takashi Sogabe

Fix wrong storage of data when hex-style string is loaded

This patch fixes corruption of data when hex-style string is
loaded.

I saw following phenomenon in an ubuntu/amd64 environment.

Test code:
str = "\x0\x1\x2\x03\x04\x05\x06\a\b\t\n\v\f\r\x0E\x0F\x10"
p str[-1] == "\0x10"

Output(binary program with mrbc -B):
false

Output(script with mruby):
true
parent 73e9c78b
...@@ -3329,7 +3329,7 @@ read_escape(parser_state *p) ...@@ -3329,7 +3329,7 @@ read_escape(parser_state *p)
break; break;
} }
} }
c = scan_hex(buf, i+1, &i); c = scan_hex(buf, i, &i);
if (i == 0) { if (i == 0) {
yyerror(p, "Invalid escape character syntax"); yyerror(p, "Invalid escape character syntax");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment