php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72005 SQL queries exceeding 8 columns and multiple rows causes segfault
Submitted: 2016-04-11 19:37 UTC Modified: 2016-04-12 00:45 UTC
From: clfenton at northeaststate dot edu Assigned: sixd (profile)
Status: Duplicate Package: OCI8 related
PHP Version: 7.0.5 OS: Ubuntu 14.04
Private report: No CVE-ID: None
 [2016-04-11 19:37 UTC] clfenton at northeaststate dot edu
Description:
------------
Server: Ubuntu 14.04.4 LTS
PHP:PHP 7.0.3-5+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
Oracle instant client 12.1 
Oci8: 2.1.0 
Apache 2.4.7


Any SQL query that returns multiple rows and is over 8 columns will cause a segfault.



TRACE START [2016-04-11 19:31:44]
    0.0007     360832  +360832   -> {main}() /home/robowman/public_html/view.debug.query.php:0
    0.0008     360832       +0     -> session_start() /home/robowman/public_html/view.debug.query.php:20
    0.0011     361472              >=> TRUE
    0.0013     361840    +1008     -> require_once(/home/robowman/public_html/inc/config.php) /home/robowman/public_html/view.debug.query.php:21
    0.0013     361840       +0       -> define('SESSION_TIMEOUT', 30) /home/robowman/public_html/inc/config.php:20
    0.0022     361872                >=> TRUE
    0.0022     361872      +32       -> define('CHECK_BROWSER', TRUE) /home/robowman/public_html/inc/config.php:23
    0.0023     361904                >=> TRUE
    0.0023     361904      +32       -> define('IP_OCTETS', 2) /home/robowman/public_html/inc/config.php:24
    0.0023     361936                >=> TRUE
    0.0023     361936      +32       -> define('SALT', 'NeSCC!(*') /home/robowman/public_html/inc/config.php:25
    0.0023     361968                >=> TRUE
    0.0023     361968      +32       -> define('REGENERATE_ID', TRUE) /home/robowman/public_html/inc/config.php:26
    0.0025     362000                >=> TRUE
    0.0025     362000      +32       -> define('ROOT_URL', 'https://172.22.1.89/robowman/') /home/robowman/public_html/inc/config.php:28
    0.0026     362032                >=> TRUE
    0.0033     362712     +712     -> require_once(/home/robowman/public_html/query/debug.query.php) /home/robowman/public_html/view.debug.query.php:23
    0.0041     364928    +2216       -> require_once(/home/robowman/public_html/class/ROBDB_Oracle_Connect.php) /home/robowman/public_html/query/debug.query.php:29
    0.0514     366648    +1720       -> ROBDB_Query::getInstance() /home/robowman/public_html/query/debug.query.php:102
    0.0515     366760     +112         -> ROBDB_Query->__construct() /home/robowman/public_html/class/ROBDB_Oracle_Connect.php:96
    0.0515     366760       +0           -> ROBDB_Oracle->__construct() /home/robowman/public_html/class/ROBDB_Oracle_Connect.php:84
    0.0516     366760       +0             -> oci_connect('dbuser', 'secret', 'OIR_BAN8') /home/robowman/public_html/class/ROBDB_Oracle_Connect.php:26
    0.2511     367040                      >=> resource(6) of type (oci8 connection)
    0.2512     367040                >=> class ROBDB_Query { private $statement = NULL; private $error_message = NULL; private $results = NULL; protected $db_connection                                                                                                       = resource(6) of type (oci8 connection) }
    0.2513     367416     +656       -> ROBDB_Query->set_query('SELECT distinct\r\n\r\n\t\t\tSPRIDEN_ID ID,\r\n\t\t\tSPRIDEN_LAST_NAME || \', \'|| SPRIDEN_FIRST_NAME ||                                                                                                       \' \' || SPRIDEN_MI AS EMPLOYEE,\r\n\t\t\t\r\n\t\t\tPOSITION_TITLE AS WORKING_TITLE,\r\n\t\t\tpevempl_birth_date as Birthdate,\r\n\t\t\tpevempl_sex as Gender,\r\n\t\t\tp                                                                                                      evempl_ethn_code as Ethnicity,\r\n\t\t\tEMPLOYEE_CLASS as e_class,\r\n\t\t\tCURRENT_HIRE_DATE AS HIRE_DT,\r\n\t\t\tseniority_date as seniority,\r\n\t\t\ta.effective_date                                                                                                       as effective_date,\r\n\t\t\tposition_begin_date as position_begin_date,\r\n\t\t\ta.assignment_grade as salary_grade,\r\n\t\t\tto_char(ANNUAL_SALARY,\'$999,999.99\') as                                                                                                       Salary\r\n\t\t\t\r\n\t\t\tFROM AN_EMPLOYEE_POSITION A,\r\n\t\t\t  (SELECT PERSON_UID,\r\n\t\t\t  POSITION,\r\n\t\t\t  JOB_SUFFIX,\r\n\t\t\t  MAX(EFFECTIVE_DATE) AS MAX_D                                                                                                      ATE\r\n\t\t\t  FROM AN_EMPLOYEE_POSITION\r\n\t\t\t  GROUP BY PERSON_UID, POSITION, JOB_SUFFIX) E,\r\n\t\t\t\r\n\t\t\tSPRIDEN, AP_EMPLOYEE,--nbrjlbd\r\n\t\t\tpevempl\r\n\                                                                                                      t\t\tWHERE A.PERSON_UID = E.PERSON_UID\r\n\t\t\tand pevempl_pidm = A.Person_uid\r\n\t\t\tAND A.EFFECTIVE_DATE = E.MAX_DATE\r\n\t\t\tAND A.POSITION = E.POSITION\r\n\t\t\t                                                                                                      AND A.JOB_SUFFIX = E.JOB_SUFFIX\r\n\t\t\tAND A.PERSON_UID = SPRIDEN_PIDM\t\r\n\t\t\tAND POSITION_CONTRACT_TYPE = \'P\' /*P - primary, S- seconday, O - override*/\r\n\t\t                                                                                                      \tAND SPRIDEN_CHANGE_IND IS NULL \r\n\t\t\tAND A.PERSON_UID = AP_EMPLOYEE.PERSON_UID\r\n\t\t\tAND EMPLOYEE_STATUS <> \'T\'\r\n\t\t\tAND POSITION_STATUS <> \'T\'\r\n\t\t\                                                                                                      tand pevempl_ethn_code = \'60\'\r\n\t\t\tand pevempl_ecls_code = \'AE\'\r\n\t\t\tand ( pevempl_sex = \'M\' or pevempl_sex = \'F\' )\r\n') /home/robowman/public_html/quer                                                                                                      y/debug.query.php:103
    0.2513     367416       +0         -> ROBDB_Query->prepareStatement('SELECT distinct\r\n\r\n\t\t\tSPRIDEN_ID ID,\r\n\t\t\tSPRIDEN_LAST_NAME || \', \'|| SPRIDEN_FIRST                                                                                                      _NAME || \' \' || SPRIDEN_MI AS EMPLOYEE,\r\n\t\t\t\r\n\t\t\tPOSITION_TITLE AS WORKING_TITLE,\r\n\t\t\tpevempl_birth_date as Birthdate,\r\n\t\t\tpevempl_sex as Gender,\r                                                                                                      \n\t\t\tpevempl_ethn_code as Ethnicity,\r\n\t\t\tEMPLOYEE_CLASS as e_class,\r\n\t\t\tCURRENT_HIRE_DATE AS HIRE_DT,\r\n\t\t\tseniority_date as seniority,\r\n\t\t\ta.effec                                                                                                      tive_date as effective_date,\r\n\t\t\tposition_begin_date as position_begin_date,\r\n\t\t\ta.assignment_grade as salary_grade,\r\n\t\t\tto_char(ANNUAL_SALARY,\'$999,999.                                                                                                      99\') as Salary\r\n\t\t\t\r\n\t\t\tFROM AN_EMPLOYEE_POSITION A,\r\n\t\t\t  (SELECT PERSON_UID,\r\n\t\t\t  POSITION,\r\n\t\t\t  JOB_SUFFIX,\r\n\t\t\t  MAX(EFFECTIVE_DATE)                                                                                                       AS MAX_DATE\r\n\t\t\t  FROM AN_EMPLOYEE_POSITION\r\n\t\t\t  GROUP BY PERSON_UID, POSITION, JOB_SUFFIX) E,\r\n\t\t\t\r\n\t\t\tSPRIDEN, AP_EMPLOYEE,--nbrjlbd\r\n\t\t\tpev                                                                                                      empl\r\n\t\t\tWHERE A.PERSON_UID = E.PERSON_UID\r\n\t\t\tand pevempl_pidm = A.Person_uid\r\n\t\t\tAND A.EFFECTIVE_DATE = E.MAX_DATE\r\n\t\t\tAND A.POSITION = E.POSITION\                                                                                                      r\n\t\t\tAND A.JOB_SUFFIX = E.JOB_SUFFIX\r\n\t\t\tAND A.PERSON_UID = SPRIDEN_PIDM\t\r\n\t\t\tAND POSITION_CONTRACT_TYPE = \'P\' /*P - primary, S- seconday, O - override*                                                                                                      /\r\n\t\t\tAND SPRIDEN_CHANGE_IND IS NULL \r\n\t\t\tAND A.PERSON_UID = AP_EMPLOYEE.PERSON_UID\r\n\t\t\tAND EMPLOYEE_STATUS <> \'T\'\r\n\t\t\tAND POSITION_STATUS <> \'T\'                                                                                                      \r\n\t\t\tand pevempl_ethn_code = \'60\'\r\n\t\t\tand pevempl_ecls_code = \'AE\'\r\n\t\t\tand ( pevempl_sex = \'M\' or pevempl_sex = \'F\' )\r\n') /home/robowman/public_                                                                                                      html/class/ROBDB_Oracle_Connect.php:110
    0.2514     367416       +0           -> oci_parse(resource(6) of type (oci8 connection), 'SELECT distinct\r\n\r\n\t\t\tSPRIDEN_ID ID,\r\n\t\t\tSPRIDEN_LAST_NAME || \                                                                                                      ', \'|| SPRIDEN_FIRST_NAME || \' \' || SPRIDEN_MI AS EMPLOYEE,\r\n\t\t\t\r\n\t\t\tPOSITION_TITLE AS WORKING_TITLE,\r\n\t\t\tpevempl_birth_date as Birthdate,\r\n\t\t\tpev                                                                                                      empl_sex as Gender,\r\n\t\t\tpevempl_ethn_code as Ethnicity,\r\n\t\t\tEMPLOYEE_CLASS as e_class,\r\n\t\t\tCURRENT_HIRE_DATE AS HIRE_DT,\r\n\t\t\tseniority_date as senior                                                                                                      ity,\r\n\t\t\ta.effective_date as effective_date,\r\n\t\t\tposition_begin_date as position_begin_date,\r\n\t\t\ta.assignment_grade as salary_grade,\r\n\t\t\tto_char(ANNU                                                                                                      AL_SALARY,\'$999,999.99\') as Salary\r\n\t\t\t\r\n\t\t\tFROM AN_EMPLOYEE_POSITION A,\r\n\t\t\t  (SELECT PERSON_UID,\r\n\t\t\t  POSITION,\r\n\t\t\t  JOB_SUFFIX,\r\n\t\t\t                                                                                                        MAX(EFFECTIVE_DATE) AS MAX_DATE\r\n\t\t\t  FROM AN_EMPLOYEE_POSITION\r\n\t\t\t  GROUP BY PERSON_UID, POSITION, JOB_SUFFIX) E,\r\n\t\t\t\r\n\t\t\tSPRIDEN, AP_EMPLOYEE,-                                                                                                      -nbrjlbd\r\n\t\t\tpevempl\r\n\t\t\tWHERE A.PERSON_UID = E.PERSON_UID\r\n\t\t\tand pevempl_pidm = A.Person_uid\r\n\t\t\tAND A.EFFECTIVE_DATE = E.MAX_DATE\r\n\t\t\tAND A.P                                                                                                      OSITION = E.POSITION\r\n\t\t\tAND A.JOB_SUFFIX = E.JOB_SUFFIX\r\n\t\t\tAND A.PERSON_UID = SPRIDEN_PIDM\t\r\n\t\t\tAND POSITION_CONTRACT_TYPE = \'P\' /*P - primary, S- se                                                                                                      conday, O - override*/\r\n\t\t\tAND SPRIDEN_CHANGE_IND IS NULL \r\n\t\t\tAND A.PERSON_UID = AP_EMPLOYEE.PERSON_UID\r\n\t\t\tAND EMPLOYEE_STATUS <> \'T\'\r\n\t\t\tAND POS                                                                                                      ITION_STATUS <> \'T\'\r\n\t\t\tand pevempl_ethn_code = \'60\'\r\n\t\t\tand pevempl_ecls_code = \'AE\'\r\n\t\t\tand ( pevempl_sex = \'M\' or pevempl_sex = \'F\' )\r\n') /                                                                                                      home/robowman/public_html/class/ROBDB_Oracle_Connect.php:133
    0.2515     369104                    >=> resource(7) of type (oci8 statement)
    0.2518     369104    +1688       -> ROBDB_Query->execute_statement() /home/robowman/public_html/query/debug.query.php:109
    0.2518     369104       +0         -> oci_execute(resource(7) of type (oci8 statement)) /home/robowman/public_html/class/ROBDB_Oracle_Connect.php:144
    0.2690     382560                  >=> TRUE
    0.2691     382560   +13456       -> ROBDB_Query->fetch_all() /home/robowman/public_html/query/debug.query.php:111
    0.2691     382584      +24         -> oci_fetch_all(resource(7) of type (oci8 statement), '') /home/robowman/public_html/class/ROBDB_Oracle_Connect.php:184


part: 1
positions: line

events: Time

fl=(1) php:internal
fn=(1) php::session_start
20 226

fl=(1)
fn=(2) php::define
20 12

fl=(1)
fn=(2)
23 1

fl=(1)
fn=(2)
24 0

fl=(1)
fn=(2)
25 0

fl=(1)
fn=(2)
26 134

fl=(1)
fn=(2)
28 1

fl=(2) /home/robowman/public_html/inc/config.php
fn=(3) require_once::/home/robowman/public_html/inc/config.php
1 1081
cfl=(1)
cfn=(2)
calls=1 0 0
20 12
cfl=(1)
cfn=(2)
calls=1 0 0
23 1
cfl=(1)
cfn=(2)
calls=1 0 0
24 0
cfl=(1)
cfn=(2)
calls=1 0 0
25 0
cfl=(1)
cfn=(2)
calls=1 0 0
26 134
cfl=(1)
cfn=(2)
calls=1 0 0
28 1

fl=(3) /home/robowman/public_html/class/ROBDB_Oracle_Connect.php
fn=(4) require_once::/home/robowman/public_html/class/ROBDB_Oracle_Connect.php
1 2

fl=(1)
fn=(5) php::oci_connect
26 199386

fl=(3)
fn=(6) ROBDB_Oracle->__construct
23 177
cfl=(1)
cfn=(5)
calls=1 0 0
26 199386

fl=(3)
fn=(7) ROBDB_Query->__construct
82 120
cfl=(3)
cfn=(6)
calls=1 0 0
84 199563

fl=(3)
fn=(8) ROBDB_Query::getInstance
93 56
cfl=(3)
cfn=(7)
calls=1 0 0
96 199684

fl=(1)
fn=(9) php::oci_parse
133 120

fl=(3)
fn=(10) ROBDB_Query->prepareStatement
131 292
cfl=(1)
cfn=(9)
calls=1 0 0
133 120

fl=(3)
fn=(11) ROBDB_Query->set_query
108 58
cfl=(3)
cfn=(10)
calls=1 0 0
110 412

fl=(1)
fn=(12) php::oci_execute
144 17128

fl=(3)
fn=(13) ROBDB_Query->execute_statement
142 76
cfl=(1)
cfn=(12)
calls=1 0 0
144 17128




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-11 19:40 UTC] clfenton at northeaststate dot edu
If the query returns only 1 row and has more than 8 columns, there is no problem.
 [2016-04-12 00:45 UTC] sixd@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: sixd
 [2016-04-12 00:45 UTC] sixd@php.net
Dup of Bug #71600
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 05:03:14 2021 UTC