From 99dc885974bfe637f3e74f52efdbbf77d66d0d68 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 1 Jul 2019 13:56:55 +0900 Subject: Fixed inadvertent ID creation in rb_iv_get --- variable.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'variable.c') diff --git a/variable.c b/variable.c index a6910985fa..b902fef003 100644 --- a/variable.c +++ b/variable.c @@ -3361,8 +3361,13 @@ rb_mod_remove_cvar(VALUE mod, VALUE name) VALUE rb_iv_get(VALUE obj, const char *name) { - ID id = rb_intern(name); + ID id = rb_check_id_cstr(name, strlen(name), rb_usascii_encoding()); + if (!id) { + if (RTEST(ruby_verbose)) + rb_warning("instance variable %s not initialized", name); + return Qnil; + } return rb_ivar_get(obj, id); } -- cgit v1.2.1