Skip to content

Commit e8800cb

Browse files
byrootyuhang-lab
andcommitted
Further validate generator depth config
Co-Authored-By: Yuhang Wu <yuhang@depthfirst.com>
1 parent 1e276eb commit e8800cb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

ext/json/ext/generator/generator.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,9 @@ static long depth_config(VALUE num)
15901590
if (RB_UNLIKELY(d < 0)) {
15911591
rb_raise(rb_eArgError, "depth must be >= 0 (got %ld)", d);
15921592
}
1593+
if (RB_UNLIKELY(d > INT_MAX)) {
1594+
rb_raise(rb_eArgError, "depth is too large (got %ld)", d);
1595+
}
15931596
return d;
15941597
}
15951598

0 commit comments

Comments
 (0)