On Thu, Feb 07, 2002 at 10:26:07AM -0500, Jeff Urlwin wrote:
> Tim,
> 
> I, accidentally had DBI_TRACE set to 1 in the environment and I get an
> invalid pointer problem in DBI dispatch during t/preparse.t.  I've traced it
> to the following lines, but am unsure of how to handle it...could it be that
> the stack is getting corrupted in preparse error handling?  I didn't see
> anything obvious to me...
> 
>       for(i=0; i < outitems; ++i) {
>           SV *s = ST(i);
>               --> SvROK(s) crashes here, during test #6 in t/preparse.t
>               S is not a "good" pointer and has the value 0x00000008
>           if ( SvROK(s) && SvTYPE(SvRV(s))==SVt_PVAV) {
>               AV *av = (AV*)SvRV(s);
>               int avi;
>               PerlIO_printf(logfp,"\n\there2 %d\n", i);
>               PerlIO_printf(logfp, " [");
>               for(avi=0; avi <= AvFILL(av); ++avi)
>                   PerlIO_printf(logfp, " %s",  neatsvpv(AvARRAY(av)[avi],0));
>               PerlIO_printf(logfp, " ]");
>           }
> 
> Sorry I couldn't trace it any further.

It's preparse returning 0 instead of &sv_undef on error.
I've attached a patch.

Tim.
*** DBI.xs      2002/02/07 03:00:53     11.6
--- DBI.xs      2002/02/07 18:39:24
***************
*** 1,4 ****
! /* $Id: DBI.xs,v 11.6 2002/02/07 03:00:53 timbo Exp timbo $
   *
   * Copyright (c) 1994, 1995, 1996, 1997  Tim Bunce  England.
   *
--- 1,4 ----
! /* $Id: DBI.xs,v 11.6 2002/02/07 03:00:53 timbo Exp $
   *
   * Copyright (c) 1994, 1995, 1996, 1997  Tim Bunce  England.
   *
***************
*** 2574,2580 ****
                        char buf[99];
                        sprintf(buf, "preparse found placeholder :%d out of sequence, 
expected :%d", pln, idx);
                        set_err(dbh, imp_xxh, 1, buf, 0);
!                       return 0;
                     }
                   while(isDIGIT(*src)) src++;
                     idx++;
--- 2574,2580 ----
                        char buf[99];
                        sprintf(buf, "preparse found placeholder :%d out of sequence, 
expected :%d", pln, idx);
                        set_err(dbh, imp_xxh, 1, buf, 0);
!                       return &sv_undef;
                     }
                   while(isDIGIT(*src)) src++;
                     idx++;
***************
*** 2605,2611 ****
            char buf[99];
            sprintf(buf, "preparse found mixed placeholder styles (%s / %s)", style, 
laststyle);
            set_err(dbh, imp_xxh, 1, buf, 0);
!             return 0;
          }
        laststyle = style;
      }
--- 2605,2611 ----
            char buf[99];
            sprintf(buf, "preparse found mixed placeholder styles (%s / %s)", style, 
laststyle);
            set_err(dbh, imp_xxh, 1, buf, 0);
!             return &sv_undef;
          }
        laststyle = style;
      }

Reply via email to