_invlist_intersection() didn't work for NULL first param
authorKarl Williamson <public@khwilliamson.com>
Tue, 23 Jul 2013 16:40:07 +0000 (10:40 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 23 Jul 2013 16:52:14 +0000 (10:52 -0600)
It is supposed to accept a NULL first parameter (one of the operands to
the intersection).  This adds a special case for it.

regcomp.c

index 0211f96..be45caa 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -7836,7 +7836,7 @@ Perl__invlist_intersection_maybe_complement_2nd(pTHX_ SV* const a, SV* const b,
     assert(a != b);
 
     /* Special case if either one is empty */
-    len_a = _invlist_len(a);
+    len_a = (a == NULL) ? 0 : _invlist_len(a);
     if ((len_a == 0) || ((len_b = _invlist_len(b)) == 0)) {
 
         if (len_a != 0 && complement_b) {