php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9505 Pointer not set exception on a realloc
Submitted: 2001-02-28 19:14 UTC Modified: 2001-04-30 01:40 UTC
From: amra at us dot ibm dot com Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0.4pl1 OS: OS400
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: amra at us dot ibm dot com
New email:
PHP Version: OS:

 

 [2001-02-28 19:14 UTC] amra at us dot ibm dot com
Got the PHP to compile and build, now I am doing some simple tests.  On initial invocation to PHP, I get the following exception:

Message . . . . :   Pointer not set for location referenced.           
Cause . . . . . :   A pointer was used, either directly or as a basing pointer, that has not been set to an address.                        
                                                                       
The exception was in c file zend_alloc.c, routine _erealloc().  The problem code is the first  line:

ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
      zend_mem_header *p = (zend_mem_header *) ((char *)ptr-sizeof(zend_mem_header)-PLATFORM_PADDING);
        zend_mem_header *orig = p;
    
	DECLARE_CACHE_VARS
	ALS_FETCH();

	if (!ptr) {
		return _emalloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
	}
  .
  .
  .
}

The first line is referencing the pointer without checking if it is NULL.  I moved the first 2 lines after the if-check and it cleared up the problem.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-09 12:42 UTC] amra at us dot ibm dot com
Just wondering what the status of this is...
 [2001-04-30 01:40 UTC] andi@php.net
I see no reason why this would cause a crash. Why shouldn't I be able to do some pointer arithmetic in the beginning? There is no de-referencing of pointers so your machine shouldn't care. In any case, please try the latest CVS. I commited your request for change because it doesn't make a difference. Let me know if it works for you now (andi@zend.com)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 08:01:27 2025 UTC