summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-06-16 01:03:15 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-06-16 18:25:35 +0900
commit26c179d7e7e7ae0eb21050659c3e8778358230ab (patch)
treebc1aef0169e3f849295e7fdca4b1371c3b7ae137 /gc.c
parent19cabe8b09d92d033c244f32ff622b8e513375f1 (diff)
Check argument to ObjectSpace._id2ref
Ensure that the argument is an Integer or implicitly convert to, before dereferencing as a Bignum. Addressed a regression in b99833baec2. Reported by u75615 at https://hackerone.com/reports/898614
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index b8c5239304..29ae8e56de 100644
--- a/gc.c
+++ b/gc.c
@@ -3716,6 +3716,7 @@ id2ref(VALUE objid)
VALUE orig;
void *p0;
+ objid = rb_to_int(objid);
if (FIXNUM_P(objid) || rb_big_size(objid) <= SIZEOF_VOIDP) {
ptr = NUM2PTR(objid);
if (ptr == Qtrue) return Qtrue;