Skip to content

Commit e5694b9

Browse files
committed
embed.fnc/group_end: correct the patend pointer decorator
This was incorrectly asserting the supplied string had at least one character, which could produce an assertion instead of a useful error message for the user of pack(). Related to #23980
1 parent d79d169 commit e5694b9

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

embed.fnc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5306,7 +5306,7 @@ ST |char |first_symbol |NN const char *pat \
53065306
RS |const char *|get_num |NN const char *patptr \
53075307
|NN SSize_t *lenptr
53085308
S |const char *|group_end |SPTR const char *patptr \
5309-
|EPTR const char *patend \
5309+
|EPTRQ const char *patend \
53105310
|char ender
53115311
RS |SV * |is_an_int |NN const char *s \
53125312
|STRLEN l

proto.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

t/op/pack.t

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ BEGIN {
66
set_up_inc(qw '../lib ../cpan/Math-BigInt/lib');
77
}
88

9-
plan tests => 14724;
9+
plan tests => 14726;
1010

1111
use strict;
1212
use warnings qw(FATAL all);
@@ -2066,3 +2066,10 @@ SKIP:
20662066
like("$@", qr{Mismatched brackets in template},
20672067
"should match brackets correctly even without recursion");
20682068
}
2069+
2070+
{ # see discussion in #23980
2071+
ok !eval { my $x = pack "C["; 1 },
2072+
"pack throws with no closing ]";
2073+
like $@, qr/No group ending character '\]' found in template/,
2074+
"check the message";
2075+
}

0 commit comments

Comments
 (0)