From b0886d5692dd58bed608fe8fb2be0c017c729060 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 17 Dec 2016 15:08:05 +0900 Subject: Zero length heredoc still crashed; ref Shopify/mruby-internal#81 --- mrbgems/mruby-compiler/core/parse.y | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'mrbgems/mruby-compiler/core/parse.y') diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index fac779b07..ec9b652d7 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -3948,8 +3948,12 @@ parse_string(parser_state *p) } } if ((len-1 == hinf->term_len) && (strncmp(s, hinf->term, len-1) == 0)) { - if (c < 0) p->parsing_heredoc = NULL; - return tHEREDOC_END; + if (c < 0) { + p->parsing_heredoc = NULL; + } + else { + return tHEREDOC_END; + } } } if (c < 0) { -- cgit v1.2.3