On Wed, Apr 25, 2007 at 11:30:52PM +0100, Rob Davies wrote: > > I have tracked down a subtle bug in selectrow_arrayref. It's in > DBI-1.54/Driver.xst, so it's probably in various drivers - I found it > in DBD-Oracle-1.19. > > What happens is selectrow_arrayref calls dbixst_bounce_method which uses > EXPAND to grow the stack. This may cause the stack to be realloc'd > with the result that the stack has moved to a new location when > dbixst_bounce_method returns. selectrow_arrayref doesn't take this into > account and carries on using the old location in its copy of sp.
Good catch. > The patch below is my attempt at fixing the problem. Someone who actually > understands perl and XS may well be able to come up with something better. > The patch is for Driver.xst in DBI version 1.54. I tested the fix in > DBD::Oracle and it does provide a cure. > > I've checked all the other places where dbixst_bounce_method is used, and > as far as I can tell this is the only one that causes a problem. > selectall_arrayref may be affected, but I don't think this is the case. > All of the other functions that use it appear to not use sp before they > return. > + /* The following two lines are needed in case dbixst_bounce_method > + caused the stack to be reallocated */ > + SPAGAIN; > + sp -= items; Thanks for this Rob. I've applied the fix to both selectall_arrayref and selectrow_arrayref. Tim. p.s. I expect to release 1.55 next week.
