From c2a6ff7af8a49609fb3126271cf4ebbfa3c2403e Mon Sep 17 00:00:00 2001 From: Takashi Sogabe Date: Thu, 18 Oct 2012 17:35:56 +0900 Subject: 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 --- src/parse.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.2.3