From 1535e031df5a267680f3f9027f7fb02938d80681 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 24 Jul 2023 07:53:12 +0900 Subject: [PATCH] mruby-pack/pack.c (read_tmpl): direct return from skipping directives We used to read counts after spaces, for example `pack("j 4")` read `4` as counts after a space. --- mrbgems/mruby-pack/src/pack.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mrbgems/mruby-pack/src/pack.c b/mrbgems/mruby-pack/src/pack.c index 7ff3e0e17..282f5e73e 100644 --- a/mrbgems/mruby-pack/src/pack.c +++ b/mrbgems/mruby-pack/src/pack.c @@ -1440,9 +1440,8 @@ read_tmpl(mrb_state *mrb, struct tmpl *tmpl, enum pack_type *typep, int *sizep, mrb_value s = mrb_str_new(mrb, &c, 1); mrb_raisef(mrb, E_ARGUMENT_ERROR, "unknown unpack directive %!v", s); } - dir = PACK_DIR_SKIP; - type = PACK_TYPE_NONE; - break; + *typep = PACK_TYPE_NONE; + return PACK_DIR_SKIP; } /* read suffix [0-9*_!<>] */