This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
assert() that itersvp is non-NULL.
authorJarkko Hietaniemi <jhi@iki.fi>
Wed, 3 Feb 2016 13:11:14 +0000 (08:11 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 7 Feb 2016 13:23:46 +0000 (08:23 -0500)
Coverity CID 135011 Explicit null derefenced

In pp_iter() there are multiple derefers of *itersvp, but at the
setting of itersvp the CxITERVAR() can return NULL, add an assert()
to catch the badness in debug builds (as the Coverity builds are).

pp_hot.c

index 1a2a725..d5c1172 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2632,6 +2632,7 @@ PP(pp_iter)
 
     cx = CX_CUR();
     itersvp = CxITERVAR(cx);
+    assert(itersvp);
 
     switch (CxTYPE(cx)) {