php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8531 $value = odbc_autocommit($handle) core dump
Submitted: 2001-01-03 09:26 UTC Modified: 2001-04-16 22:06 UTC
From: hl at streamdesign dot de Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.4 OS: RedHat Linux 6.1
Private report: No CVE-ID: None
 [2001-01-03 09:26 UTC] hl at streamdesign dot de
When odbc_autocommit function has only the connection id parameter, php crash with a "core dump"!

<?php
$dbh = odbc_connect("localhost:ingoteam", "developer", "*********");
odbc_autocommit($dbh);
odbc_close($dbh);
?>


####### Your Problem!!! #######
file: ext/odbc/php_odbc.c
line: 2338

source:
      :
      :
   pval **pv_conn, **pv_onoff = NULL;  #### set to NULL
   int argc;

   argc = ZEND_NUM_ARGS();
   if (argc == 2) {
      if (zend_get_parameters_ex(2, &pv_conn, &pv_onoff) == FAILURE) {
         WRONG_PARAM_COUNT;
      }
   } else if (argc == 1) {
      if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
         WRONG_PARAM_COUNT;
      }
   } else {
      WRONG_PARAM_COUNT;
   }

   ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);

#ifndef HAVE_DBMAKER
   if ((*pv_onoff)) { #### check value of an NULL pointer
#else
   if (pv_onoff && (*pv_onoff)) {
#endif

###############################
When no DBMaker is activ (HAVE_DBMAKER does set), the
line "if ((*pv_onoff))" will not work! There was only
one option, pointer of "pv_onoff" is NULL, but the if-
statement check the value of "pv_onoff"!?

There are no way to check the autocommit status!
###############################

(gdb) r test.php
Starting program: /home/hl/tmp/php-4.0.4/./php test.php

Program received signal SIGSEGV, Segmentation fault.
0x8071aeb in php_if_odbc_autocommit (ht=1, return_value=0x820b44c, this_ptr=0x0, return_value_used=0) at php_odbc.c:2339
2339		if ((*pv_onoff)) {
(gdb) bt
#0  0x8071aeb in php_if_odbc_autocommit (ht=1, return_value=0x820b44c, this_ptr=0x0, return_value_used=0) at php_odbc.c:2339
#1  0x8121c69 in execute (op_array=0x820ff1c) at ./zend_execute.c:1519
#2  0x80eaa1b in zend_execute_scripts (type=8, file_count=3) at zend.c:729
#3  0x80678cc in php_execute_script (primary_file=0xbffff8a0) at main.c:1221
#4  0x8065a49 in main (argc=2, argv=0xbffff914) at cgi_main.c:738
(gdb) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-16 22:06 UTC] kalowsky@php.net
should be fixed in cvs.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 01:01:30 2024 UTC