This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec.c: Use Perl_croak_nocontext()
authorKarl Williamson <khw@cpan.org>
Wed, 16 Sep 2015 21:58:27 +0000 (15:58 -0600)
committerKarl Williamson <khw@cpan.org>
Wed, 16 Sep 2015 22:04:20 +0000 (16:04 -0600)
Instead of doing a dTHX introduced in
22b433eff9a1ffa2454e18405a56650f07b385b5.  I should have pointed out in
that commit message, that instead of doing a full-fledged UTF-8
well-formedness check, it does a quick sanity check sufficient to
prevent looping

Spotted by Vincent Pitt

regexec.c

index 1aa0c47..e92e7a3 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -8762,8 +8762,7 @@ S_reghop3(U8 *s, SSize_t off, const U8* lim)
                 while (s > lim && UTF8_IS_CONTINUATION(*s))
                     s--;
                 if (! UTF8_IS_START(*s)) {
                 while (s > lim && UTF8_IS_CONTINUATION(*s))
                     s--;
                 if (! UTF8_IS_START(*s)) {
-                    dTHX;
-                    Perl_croak(aTHX_ "Malformed UTF-8 character (fatal)");
+                    Perl_croak_nocontext("Malformed UTF-8 character (fatal)");
                 }
            }
             /* XXX could check well-formedness here */
                 }
            }
             /* XXX could check well-formedness here */
@@ -8790,8 +8789,7 @@ S_reghop4(U8 *s, SSize_t off, const U8* llim, const U8* rlim)
                 while (s > llim && UTF8_IS_CONTINUATION(*s))
                     s--;
                 if (! UTF8_IS_START(*s)) {
                 while (s > llim && UTF8_IS_CONTINUATION(*s))
                     s--;
                 if (! UTF8_IS_START(*s)) {
-                    dTHX;
-                    Perl_croak(aTHX_ "Malformed UTF-8 character (fatal)");
+                    Perl_croak_nocontext("Malformed UTF-8 character (fatal)");
                 }
             }
             /* XXX could check well-formedness here */
                 }
             }
             /* XXX could check well-formedness here */
@@ -8823,8 +8821,7 @@ S_reghopmaybe3(U8* s, SSize_t off, const U8* lim)
                 while (s > lim && UTF8_IS_CONTINUATION(*s))
                     s--;
                 if (! UTF8_IS_START(*s)) {
                 while (s > lim && UTF8_IS_CONTINUATION(*s))
                     s--;
                 if (! UTF8_IS_START(*s)) {
-                    dTHX;
-                    Perl_croak(aTHX_ "Malformed UTF-8 character (fatal)");
+                    Perl_croak_nocontext("Malformed UTF-8 character (fatal)");
                 }
            }
             /* XXX could check well-formedness here */
                 }
            }
             /* XXX could check well-formedness here */