This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix a null pointer dereference segfault in Storable.
[perl5.git] / dist / Storable / Storable.xs
index 3788f57..a72d84c 100644 (file)
@@ -5660,6 +5660,10 @@ static SV *retrieve_code(pTHX_ stcxt_t *cxt, const char *cname)
                CROAK(("Unexpected type %d in retrieve_code\n", type));
        }
 
+       if (!text) {
+               CROAK(("Unable to retrieve code\n"));
+       }
+
        /*
         * prepend "sub " to the source
         */
@@ -5780,7 +5784,7 @@ static SV *old_retrieve_array(pTHX_ stcxt_t *cxt, const char *cname)
                        continue;                       /* av_extend() already filled us with undef */
                }
                if (c != SX_ITEM)
-                       (void) retrieve_other(aTHX_ (stcxt_t *) 0, 0);  /* Will croak out */
+                       (void) retrieve_other(aTHX_ cxt, 0);    /* Will croak out */
                TRACEME(("(#%d) item", i));
                sv = retrieve(aTHX_ cxt, 0);                                            /* Retrieve item */
                if (!sv)
@@ -5857,7 +5861,7 @@ static SV *old_retrieve_hash(pTHX_ stcxt_t *cxt, const char *cname)
                        if (!sv)
                                return (SV *) 0;
                } else
-                       (void) retrieve_other(aTHX_ (stcxt_t *) 0, 0);  /* Will croak out */
+                       (void) retrieve_other(aTHX_ cxt, 0);    /* Will croak out */
 
                /*
                 * Get key.
@@ -5868,7 +5872,7 @@ static SV *old_retrieve_hash(pTHX_ stcxt_t *cxt, const char *cname)
 
                GETMARK(c);
                if (c != SX_KEY)
-                       (void) retrieve_other(aTHX_ (stcxt_t *) 0, 0);  /* Will croak out */
+                       (void) retrieve_other(aTHX_ cxt, 0);    /* Will croak out */
                RLEN(size);                                             /* Get key size */
                KBUFCHK((STRLEN)size);                                  /* Grow hash key read pool if needed */
                if (size)