summaryrefslogtreecommitdiff
path: root/pack.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-28 09:26:06 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-28 09:26:06 +0000
commit7357f524beb54ce64c5669afa39e6c68a72cea9b (patch)
treeea662c985b989a2081e412e4e7f4b4dbb6805e9e /pack.c
parent8db32a2b89df4687018fb0d7741acd284084e136 (diff)
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/branches/ruby_2_5@62975 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 45b816a590..12f30cb6b0 100644
--- a/pack.c
+++ b/pack.c
@@ -1127,7 +1127,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");
}
}