summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2012-04-06 17:47:14 -0300
committerFather Chrysostomos <sprout@cpan.org>2012-04-06 22:00:14 -0700
commiteade71555e37e053d1aa5b29a45a0f06b3a3458f (patch)
tree710a44f9e5ace1ca37dd96f969395b33c1473f0c /pp_ctl.c
parentfae6f8faebd031ebdb5f318e8a671e018b9a63c1 (diff)
downloadperl-eade71555e37e053d1aa5b29a45a0f06b3a3458f.tar.gz
Fix for perl #112316: Wrong behavior regarding labels with same prefix
The code that compared non UTF-8 labels neglected to check that the label's length was equal before comparing them with a memEQ, which lead to code that used labels with the same prefixes to fail: ./perl -Ilib -E 'CATCH: { CATCHLOOP: { last CATCH; } die }'
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 80aa419662..8f4c10343e 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1424,8 +1424,8 @@ S_dopoptolabel(pTHX_ const char *label, STRLEN len, U32 flags)
: (bytes_cmp_utf8(
(const U8*)label, len,
(const U8*)cx_label, cx_label_len) == 0)
- : ((cx_label == label)
- || memEQ(cx_label, label, len))) ) {
+ : (len == cx_label_len && ((cx_label == label)
+ || memEQ(cx_label, label, len))) )) {
DEBUG_l(Perl_deb(aTHX_ "(poptolabel(): skipping label at cx=%ld %s)\n",
(long)i, cx_label));
continue;
@@ -2806,8 +2806,8 @@ S_dofindlabel(pTHX_ OP *o, const char *label, STRLEN len, U32 flags, OP **opstac
: (bytes_cmp_utf8(
(const U8*)label, len,
(const U8*)kid_label, kid_label_len) == 0)
- : ((kid_label == label)
- || memEQ(kid_label, label, len))))
+ : ( len == kid_label_len && ((kid_label == label)
+ || memEQ(kid_label, label, len)))))
return kid;
}
}