summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2026-01-12 17:02:01 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2026-01-12 17:02:01 -0800
commitb170f02e0f2a7831b51a9279ee2d35a5e4ecace9 (patch)
treedc8289ce036c492f1525ccfc43d186754ba0549d
parentcc4ce48f1277125df6c981a21efa4256c350a8ae (diff)
merge revision(s) 4e0bb58a0a374b40b7691e7b7aa88e759a0fc9f2: [Backport #21811]
[PATCH] fix underflow
-rw-r--r--pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pack.c b/pack.c
index 3a5c1bfb96..87a5c67871 100644
--- a/pack.c
+++ b/pack.c
@@ -302,7 +302,7 @@ pack_pack(rb_execution_context_t *ec, VALUE ary, VALUE fmt, VALUE buffer)
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");
}
}