Bug #2397: Segmentation fault when using date with 'g' or 'G' in the format string
| From: | venkat at manton dot com | Date: | Tue, 28 Sep 1999 16:52:34 +0000 |
| Subject: | Bug #2397: Segmentation fault when using date with 'g' or 'G' in the format string | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-11356@lists.php.net to get a copy of this message | ||
From: venkat@manton.com
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