[PHP-DEV] PHP 4.0 Bug #9505 Updated: Pointer not set exception on a realloc From: amra <email protected>
Date: 03/02/01

ID: 9505
User Update by: amra <email protected>
Status: Open
Bug Type: Reproduceable crash
Description: Pointer not set exception on a realloc

Previous Comments:
---------------------------------------------------------------------------

[2001-02-28 19:14:57] amra <email protected>
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.

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

Full Bug description available at: http://bugs.php.net/?id=9505

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>