Bug #73002 [Opn]: bigendian64/php7/oci8: output bind-variables doesn't work

From: Date: Fri, 28 Apr 2017 08:34:36 +0000
Subject: Bug #73002 [Opn]: bigendian64/php7/oci8: output bind-variables doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208828@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73002&edit=1

 ID:                 73002
 User updated by:    lzsiga at freemail dot c3 dot hu
 Reported by:        lzsiga at freemail dot c3 dot hu
 Summary:            bigendian64/php7/oci8: output bind-variables doesn't
                     work
 Status:             Open
 Type:               Bug
 Package:            OCI8 related
 Operating System:   64-bit / BigEndian
-PHP Version:        7.0.10
+PHP Version:        7.*
 Block user comment: N
 Private report:     N

 New Comment:

Moved the patch to versiom 7.1.4


Previous Comments:
------------------------------------------------------------------------
[2016-09-16 10:29:39] lzsiga at freemail dot c3 dot hu

Modified the patch to match version 7.0.11

------------------------------------------------------------------------
[2016-09-08 10:35:38] lzsiga at freemail dot c3 dot hu

Hi, I had to add some lines to prevent destruction of 'IN-only' bind variables. (I think
'php_oci_bind' should be reorganized, field 'dummy_len' replaced with fields
'maximum_len', 'before_exec_len' and 'after_exec_len'. Also it should
be tracked in a boolean field if 'bind_out_callback' has been called on the field or not.
If not, the bind-variable shouldn't be changed in 'bind_post_exec')

------------------------------------------------------------------------
[2016-09-02 11:14:34] lzsiga at freemail dot c3 dot hu

Description:
------------
Hi, I think I've found a little bug in component ext/oci8 that affects only 64-bit big-endian
platforms.

In ext/oci8/oci8_statement.c:php_oci_bind_out_callback (line 1461) the program assumes that
&val->string->len (type size_t *) can be type-casted to (ub4 *)

Well, that works on 32-bit platforms, also on 64-bit/little-endian platforms, but fails on
bi-bit/big-endian platforms such as PowerPc64/Aix (size_t is eight bytes, ub4 is four bytes, and a
simple type-cast does the wrong thing).

The attached patch seems to solve the problem.

Test script:
---------------
/* anonymous PL/SQL block */

BEGIN
  SELECT ename INTO :ename FROM emp WHERE empno=7876;
END;

Expected result:
----------------
ename=ADAMS

Actual result:
--------------
oci_execute(): ORA-03131: an invalid buffer was provided for the next piece


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73002&edit=1


Thread (29 messages)

« previous php.bugs (#208828) next »