From af3d5d6c8aab08d5366c1da57dba375a8b2bfa5c Mon Sep 17 00:00:00 2001
From: Carlo Prelz <carlo.prelz@ispw.unibe.ch>
Date: Thu, 12 Oct 2017 09:54:02 +0200
Subject: [PATCH] Correct a small error in parse.y, which causes the reading of
 unassigned memory (triggers an error when address sanitizer is active)

---
 mrbgems/mruby-compiler/core/parse.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y
index 82e4c7bdd..243d4ce4a 100644
--- a/mrbgems/mruby-compiler/core/parse.y
+++ b/mrbgems/mruby-compiler/core/parse.y
@@ -5723,7 +5723,7 @@ mrb_parser_set_filename(struct mrb_parser_state *p, const char *f)
 
   new_table = (mrb_sym*)parser_palloc(p, sizeof(mrb_sym) * p->filename_table_length);
   if (p->filename_table) {
-    memmove(new_table, p->filename_table, sizeof(mrb_sym) * p->filename_table_length);
+    memmove(new_table, p->filename_table, sizeof(mrb_sym) * p->current_filename_index);
   }
   p->filename_table = new_table;
   p->filename_table[p->filename_table_length - 1] = sym;
-- 
2.26.2