[svn:dbd-oracle] r11576 - dbd-oracle/trunk

[email protected]
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: byterock
Date: Wed Jul 23 06:58:07 2008
New Revision: 11576

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/dbdimp.c

Log:
  Fix for memory hemorrhage in bind_param_inout_array found by Ricky Egeland, Fix by John Scoles

Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes	(original)
+++ dbd-oracle/trunk/Changes	Wed Jul 23 06:58:07 2008
@@ -1,4 +1,5 @@
 =head1 Changes in DBD-Oracle 1.22(svn rev xxxx)  2008 
+  Fix for memory hemorrhage in bind_param_inout_array found by Ricky Egeland, Fix by John Scoles
   Fix for a typo in oracle.xs from Milo van der Leij 
   Fix for bugs on SPs with Lobs reported by Martin Evans, Fix by J Scoles
   Changed the way Ping works rather than using prepare and execute it now makes a single round trip call to DB by John Scoles

Modified: dbd-oracle/trunk/dbdimp.c
==============================================================================
--- dbd-oracle/trunk/dbdimp.c	(original)
+++ dbd-oracle/trunk/dbdimp.c	Wed Jul 23 06:58:07 2008
@@ -2194,11 +2194,8 @@
 	 	PerlIO_printf(DBILOGFP, "dbd_rebind_ph_char() (1): bind %s <== %.1000s (", phs->name, val);
 	 	if (!SvOK(phs->sv))
 		    PerlIO_printf(DBILOGFP, "NULL, ");
-		PerlIO_printf(DBILOGFP, "size %ld/%ld/%ld, ",
-	    (long)SvCUR(phs->sv),(long)SvLEN(phs->sv),phs->maxlen);
-	 	PerlIO_printf(DBILOGFP, "ptype %d(%s), otype %d%s)\n",
- 	    (int)SvTYPE(phs->sv), sql_typecode_name(phs->ftype),phs->ftype,
- 	    (phs->is_inout) ? ", inout" : "");
+		PerlIO_printf(DBILOGFP, "size %ld/%ld/%d, ",(long)SvCUR(phs->sv),(long)SvLEN(phs->sv),phs->maxlen);
+	 	PerlIO_printf(DBILOGFP, "ptype %d(%s), otype %d %s)\n",(int)SvTYPE(phs->sv), sql_typecode_name(phs->ftype),phs->ftype,(phs->is_inout) ? ", inout" : "");
     }
 
     /* At the moment we always do sv_setsv() and rebind.	*/
@@ -2249,8 +2246,15 @@
     }
 
     phs->sv_type = SvTYPE(phs->sv);	/* part of mutation check	*/
-    phs->maxlen  = ((IV)SvLEN(phs->sv)); /* avail buffer space (64bit safe) Logicaly maxlen should never change but it does why I know not*/
+    if (SvTYPE(phs->sv) == SVt_RV && SvTYPE(SvRV(phs->sv)) == SVt_PVAV) { /* it is returning an array of scalars not a single scalar*/
+    	phs->maxlen  = 4000; /* Just make is a varchar max should be ok for most things*/
 
+    } else {
+   		phs->maxlen  = ((IV)SvLEN(phs->sv)); /* avail buffer space (64bit safe) Logicaly maxlen should never change but it does why I know not*/
+
+    }
+  	   
+    
     if (phs->maxlen < 0)		/* can happen with nulls	*/
 	  phs->maxlen = 0;
 
@@ -2498,7 +2502,7 @@
     if (trace_level >= 5 || dbd_verbose >= 5 )
 		PerlIO_printf(DBILOGFP, "dbd_rebind_ph() (1): rebinding %s as %s (%s, ftype %d (%s), csid %d, csform %d, inout %d)\n",
 		phs->name, (SvPOK(phs->sv) ? neatsvpv(phs->sv,10) : "NULL"),(SvUTF8(phs->sv) ? "is-utf8" : "not-utf8"),
-		phs->ftype,sql_typecode_name(phs->ftype), phs->csform, phs->is_inout);
+		phs->ftype,sql_typecode_name(phs->ftype),phs->csid, phs->csform, phs->is_inout);
 
 
     switch (phs->ftype) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.