aboutsummaryrefslogtreecommitdiffstats
path: root/pack.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-28 10:12:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-28 10:12:17 +0000
commit8227a400252ce125d16954e1bf404f49d696890b (patch)
tree3edf90694b5cc527551bd585e5952d62a942c03b /pack.c
parentfa7695989e5aa3a042a83173c8af87d8aeae48ff (diff)
downloadruby-8227a400252ce125d16954e1bf404f49d696890b.tar.gz
pack.c: fix underflow
* pack.c (pack_unpack_internal): get rid of underflow. https://hackerone.com/reports/298246 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pack.c b/pack.c
index 3f2955e4cc..3413ec6c56 100644
--- a/pack.c
+++ b/pack.c
@@ -1128,7 +1128,7 @@ pack_unpack_internal(VALUE str, VALUE fmt, int mode)
else if (ISDIGIT(*p)) {
errno = 0;
len = STRTOUL(p, (char**)&p, 10);
- if (errno) {
+ if (len < 0 || errno) {
rb_raise(rb_eRangeError, "pack length too big");
}
}