This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tie::Hash::NamedCapture::* shouldn't abort if passed bad input [RT #71828]
[perl5.git] / scope.h
diff --git a/scope.h b/scope.h
index 2f50398..64e7e27 100644 (file)
--- a/scope.h
+++ b/scope.h
@@ -134,15 +134,18 @@ scope has the given name. Name must be a literal string.
 #define ENTER_with_name(name)                                          \
     STMT_START {                                                       \
        push_scope();                                                   \
-       PL_scopestack_name[PL_scopestack_ix-1] = name;                  \
+       if (PL_scopestack_name)                                         \
+           PL_scopestack_name[PL_scopestack_ix-1] = name;              \
        DEBUG_SCOPE("ENTER \"" name "\"")                               \
     } STMT_END
 #define LEAVE_with_name(name)                                          \
     STMT_START {                                                       \
        DEBUG_SCOPE("LEAVE \"" name "\"")                               \
-       assert(((char*)PL_scopestack_name[PL_scopestack_ix-1]           \
-                   == (char*)name)                                     \
-               || strEQ(PL_scopestack_name[PL_scopestack_ix-1], name));        \
+       if (PL_scopestack_name) {                                       \
+           assert(((char*)PL_scopestack_name[PL_scopestack_ix-1]       \
+                       == (char*)name)                                 \
+                   || strEQ(PL_scopestack_name[PL_scopestack_ix-1], name));        \
+       }                                                               \
        pop_scope();                                                    \
     } STMT_END
 #else