merge revision(s) 50671: [Backport #11192]

* compile.c (iseq_compile_each): out of range NTH_REF is always
	  nil.

	* parse.y (parse_numvar): check overflow of NTH_REF and range.
	  [ruby-core:69393] [Bug #11192]

	* util.c (ruby_scan_digits): make public and add length parameter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2015-07-03 19:57:42 +00:00
parent 8ff3a728ae
commit 72fa2ec34a
7 changed files with 58 additions and 15 deletions

View file

@ -4855,6 +4855,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_NTH_REF:{
if (!poped) {
if (!node->nd_nth) {
ADD_INSN(ret, line, putnil);
break;
}
ADD_INSN2(ret, line, getspecial, INT2FIX(1) /* '~' */,
INT2FIX(node->nd_nth << 1));
}