php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7526 unixtojd (-x) causes php.exe to crash
Submitted: 2000-10-30 01:07 UTC Modified: 2000-10-30 11:14 UTC
From: zak@php.net Assigned:
Status: Closed Package: Calendar related
PHP Version: 4.0.3pl1 OS: Win2k Pro.
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zak@php.net
New email:
PHP Version: OS:

 

 [2000-10-30 01:07 UTC] zak@php.net
Hello All,

Calls to unixtojd() with a negative integer value cause php.exe to exit. The problem cannot be reproduced on OpenBSD 2.7 running PHP 4.0.3 pl 1.

(For additional information, see below patch...)

My C skills are practically non-existant. However, it seems that a simple patch like:

--- cal_unix.c	Sun Oct 29 23:00:43 2000
+++ patch.c	Sun Oct 29 23:01:47 2000
@@ -39,6 +39,9 @@
   }

   if(myargc==1) {
+    if(timestamp < 0) {
+      RETURN_FALSE;  /* before beginning of unix epoch */
+    }
+
     convert_to_long(timestamp);
     t = timestamp->value.lval;

I am probably wrong - but I thought that I should at least give a crack at fixing it. :)

I would test this patch myself, except I have no way to compile on the windows platform.

-- More info --

Windows generates a Program Error box with the following message: "php.exe has generated errors and will be closed by Windows. You will need to restart the program. An error log is being generated."

No error is reported in the system logs.

The Apache (Apache 1.3.12) error log records the error:
Premature end of script headers: c:/program files/php4/php.exe

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-30 11:14 UTC] stas@php.net
Should be fixed in CVS, please reopen if still crashes.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 16:01:28 2024 UTC