This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add assert(matches_string).
authorJarkko Hietaniemi <jhi@iki.fi>
Sat, 20 Feb 2016 13:49:04 +0000 (08:49 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 20 Feb 2016 13:49:04 +0000 (08:49 -0500)
Coverity CID #135728: Explicit null dereferenced (FORWARD_NULL)

Coverity sees an execution path that leaves matches_string NULL.

regcomp.c

index e337183..5725a3a 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -17662,6 +17662,7 @@ Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog,
                     sv_catpvs(matches_string, " ");
                 } /* end of loop through the text */
 
+                assert(matches_string);
                 if (SvCUR(matches_string)) {  /* Get rid of trailing blank */
                     SvCUR_set(matches_string, SvCUR(matches_string) - 1);
                 }