php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39871 emalloc() fails when calling sybase_query()
Submitted: 2006-12-18 15:51 UTC Modified: 2007-07-19 01:00 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: kkimmel at cse dot ohio-state dot edu Assigned:
Status: No Feedback Package: Sybase-ct (ctlib) related
PHP Version: 5.2.0, 4.4.4 OS: RHEL 4 x86_64 Kernel 2.6.9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kkimmel at cse dot ohio-state dot edu
New email:
PHP Version: OS:

 

 [2006-12-18 15:51 UTC] kkimmel at cse dot ohio-state dot edu
Description:
------------
This error happens with php 4.4.4 and php 5.2.0.

Test system:
Dual Processor Intel Xeon CPU 3.20ghz
Red Hat Enterprise 4 x86_64
glibc 2.3.4
gcc 3.4.6
apache 2.0.59
PHP 4.4.4 build flags:

./configure \
  --prefix=/opt/php-4.4.4 \
  --with-apxs2=/opt/apache-2.0.59/bin/apxs \
  --with-sybase-ct=/usr/local/sybase/OCS-12_5 \
  --enable-debug

The apache startup script exports the following env vars:
SYBASE="/usr/local/sybase"
SYBASE_OCS="OCS-12_5"
SYBASE_SYSAM="SYSAM-1_0"
LANG="en_US"

There are no errors reported from the sybase client library in the log file. I also had to hand edit ./configure because it cannot find the sybase 64bit libraries.

The below code executes correctly on our old server which ran Solaris 8, Apache 1.3.33, PHP 4.4.0 and connected to the same sybase server.

Reproduce code:
---------------
ini_set('display_errors', '1');
error_reporting(E_ALL);

$link = sybase_connect('omega', 'test1', 'pass');
$worked = sybase_select_db('dev01', $link);

$sql = "SELECT * FROM Events";
$mixed = sybase_query($sql, $link);

print_r($mixed);

Expected result:
----------------
It should print out something like the following:

Resource id #3

Actual result:
--------------
In the apache log I see the following error:

FATAL:  emalloc():  Unable to allocate 42949672961 bytes

Below is the backtrace of the code attached to this bug:

(gdb) bt
#0  0x000000374dd2e829 in kill () from /lib64/tls/libc.so.6
#1  0x0000002a956de859 in _emalloc (size=42949672961, __zend_filename=0x2a9572a338 "/tmp/php-4.4.4/ext/sybase_ct/php_sybase_ct.c", __zend_lineno=1302, 
    __zend_orig_filename=0x0, __zend_orig_lineno=0) at /tmp/php-4.4.4/Zend/zend_alloc.c:187
#2  0x0000002a956842cc in php_sybase_fetch_result_set (sybase_ptr=0x6eab50, buffered=0, store=1) at /tmp/php-4.4.4/ext/sybase_ct/php_sybase_ct.c:1302
#3  0x0000002a95684cbf in php_sybase_query (ht=2, return_value=0x6fa0b0, this_ptr=0x0, return_value_used=1, buffered=0)
    at /tmp/php-4.4.4/ext/sybase_ct/php_sybase_ct.c:1497
#4  0x0000002a9568500f in zif_sybase_query (ht=2, return_value=0x6fa0b0, this_ptr=0x0, return_value_used=1)
    at /tmp/php-4.4.4/ext/sybase_ct/php_sybase_ct.c:1626
#5  0x0000002a9570cab3 in execute (op_array=0x6ea9c0) at /tmp/php-4.4.4/Zend/zend_execute.c:1675
#6  0x0000002a956f538f in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /tmp/php-4.4.4/Zend/zend.c:934
#7  0x0000002a956b5844 in php_execute_script (primary_file=0x7fbffff270) at /tmp/php-4.4.4/main/main.c:1752
#8  0x0000002a95713453 in php_handler (r=0x6db570) at /tmp/php-4.4.4/sapi/apache2handler/sapi_apache2.c:581
#9  0x000000000043ca93 in ap_run_handler (r=0x6db570) at config.c:152
#10 0x000000000043cf31 in ap_invoke_handler (r=0x6db570) at config.c:364
#11 0x000000000042b360 in ap_process_request (r=0x6db570) at http_request.c:249
#12 0x0000000000426728 in ap_process_http_connection (c=0x6d6dd0) at http_core.c:253
#13 0x00000000004475d3 in ap_run_process_connection (c=0x6d6dd0) at connection.c:43
#14 0x000000000043af1f in child_main (child_num_arg=Variable "child_num_arg" is not available.
) at prefork.c:610
#15 0x000000000043b154 in make_child (s=0x5eda50, slot=0) at prefork.c:650
#16 0x000000000043b22e in startup_children (number_to_start=5) at prefork.c:722
#17 0x000000000043b90b in ap_mpm_run (_pconf=Variable "_pconf" is not available.
) at prefork.c:941
#18 0x0000000000441b70 in main (argc=2, argv=0x7fbffff878) at main.c:623


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-21 10:31 UTC] thomas dot pedoussaut at webresint dot com
Same problem on
CentOS 4.4
php 5.1.6
Sybase OCS-12_5
kernel 2.6.16-xen x86_64
 [2006-12-21 11:19 UTC] thomas dot pedoussaut at webresint dot com
I could also reproduce the problem with FreeTDS 0.64-1 rather that the official sybase client library.
 [2007-07-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun May 28 18:04:01 2023 UTC