[PHP-DEV] Bug #2397: Segmentation fault when using date with 'g' or 'G' in the format string From: venkat <email protected>
Date: 09/28/99

From: venkat <email protected>
Operating system: Linux v2.0.36
PHP version: 3.0.12
PHP Bug Type: Reproduceable crash
Bug description: Segmentation fault when using date with 'g' or 'G' in the format string

PHP running as an Apache v1.3.9 module.

The following script:

<?php
$current_time = date("M j Y g:i A");
?>

causes a segmentation fault of the process running the script if it is run when the hour of the local time is 2 digits (ie between 10am and 12pm and 10pm and 12am).

The problem can be traced back to the _php3_date() function in functions/datetime.c. The switch case for computing the size of the string required to hold the formatted date does not increment the size by 2 for the 'g' and 'G' cases. It is incorrectly incremented by 1.

Venkat

-- 
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>