pack.c: count should not be negative for directives xX@.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-06-13 20:13:50 +09:00
parent bf2b06ced7
commit 1ed01a8d47
+4 -1
View File
@@ -1251,7 +1251,10 @@ alias:
tmpl->idx = e - tptr;
continue;
} else if (ch == '*') {
count = -1;
if (type == PACK_TYPE_NONE)
count = 0;
else
count = -1;
} else if (ch == '_' || ch == '!' || ch == '<' || ch == '>') {
if (strchr("sSiIlLqQ", (int)t) == NULL) {
mrb_raisef(mrb, E_ARGUMENT_ERROR, "'%c' allowed only after types sSiIlLqQ", ch);