summaryrefslogtreecommitdiff
path: root/warnings.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2016-07-11 14:49:17 -0700
committerFather Chrysostomos <sprout@cpan.org>2016-07-11 17:15:20 -0700
commita2637ca0a3fec01b80d7ea5ba62802354fd5e6f3 (patch)
tree8fb368925bbe72db23bf38086f98653c9cd1a4ac /warnings.h
parentd8cc0e431ef1b9fbf32d8df0b3ddfffef0fb3009 (diff)
downloadperl-a2637ca0a3fec01b80d7ea5ba62802354fd5e6f3.tar.gz
[perl #128597] Crash from gp_free/ckWARN_d
See the explanation in the test added and in the RT ticket. The solution is to make the warn macros check that PL_curcop is non-null.
Diffstat (limited to 'warnings.h')
-rw-r--r--warnings.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/warnings.h b/warnings.h
index 337bef374c..4d137320bb 100644
--- a/warnings.h
+++ b/warnings.h
@@ -115,8 +115,10 @@
#define WARN_ALLstring "\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125"
#define WARN_NONEstring "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-#define isLEXWARN_on cBOOL(PL_curcop->cop_warnings != pWARN_STD)
-#define isLEXWARN_off cBOOL(PL_curcop->cop_warnings == pWARN_STD)
+#define isLEXWARN_on \
+ cBOOL(PL_curcop && PL_curcop->cop_warnings != pWARN_STD)
+#define isLEXWARN_off \
+ cBOOL(!PL_curcop || PL_curcop->cop_warnings == pWARN_STD)
#define isWARN_ONCE (PL_dowarn & (G_WARN_ON|G_WARN_ONCE))
#define isWARN_on(c,x) (IsSet((U8 *)(c + 1), 2*(x)))
#define isWARNf_on(c,x) (IsSet((U8 *)(c + 1), 2*(x)+1))