summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTakashi Sogabe <[email protected]>2012-10-18 17:35:56 +0900
committerTakashi Sogabe <[email protected]>2012-10-18 17:35:56 +0900
commitc2a6ff7af8a49609fb3126271cf4ebbfa3c2403e (patch)
treeb73a4ec359649f238d1600a61ef31ae0002dbd26
parent73e9c78bc40e9c9cfb359042f39925c084ced40e (diff)
downloadmruby-c2a6ff7af8a49609fb3126271cf4ebbfa3c2403e.tar.gz
mruby-c2a6ff7af8a49609fb3126271cf4ebbfa3c2403e.zip
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
-rw-r--r--src/parse.y2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/parse.y b/src/parse.y
index af12112c7..b903ac840 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -3329,7 +3329,7 @@ read_escape(parser_state *p)
break;
}
}
- c = scan_hex(buf, i+1, &i);
+ c = scan_hex(buf, i, &i);
if (i == 0) {
yyerror(p, "Invalid escape character syntax");
return 0;