SOURCES: php-strtotime-memleak.patch (NEW) - fix for bug #46889, memory lea...

hawk hawk at pld-linux.org
Thu Feb 12 16:13:00 CET 2009


Author: hawk                         Date: Thu Feb 12 15:13:00 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fix for bug #46889, memory leak in strtotime()

---- Files affected:
SOURCES:
   php-strtotime-memleak.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/php-strtotime-memleak.patch
diff -u /dev/null SOURCES/php-strtotime-memleak.patch:1.1
--- /dev/null	Thu Feb 12 16:13:00 2009
+++ SOURCES/php-strtotime-memleak.patch	Thu Feb 12 16:12:54 2009
@@ -0,0 +1,98 @@
+diff -urN php-5.2.8/ext/date/lib/parse_date.c php5.2-200902121330/ext/date/lib/parse_date.c
+--- php-5.2.8/ext/date/lib/parse_date.c	2008-12-07 20:31:16.000000000 +0100
++++ php5.2-200902121330/ext/date/lib/parse_date.c	2009-02-12 14:51:26.000000000 +0100
+@@ -22395,7 +22395,7 @@
+ 
+ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
+ {
+-	if (!(options && TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
++	if (!(options & TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
+ 		parsed->h = 0;
+ 		parsed->i = 0;
+ 		parsed->s = 0;
+@@ -22415,7 +22415,7 @@
+ 		parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
+ 	}
+ 	if (!parsed->tz_info) {
+-		parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL;
++		parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
+ 	}
+ 	if (parsed->zone_type == 0 && now->zone_type != 0) {
+ 		parsed->zone_type = now->zone_type;
+diff -urN php-5.2.8/ext/date/lib/parse_date.c.orig php5.2-200902121330/ext/date/lib/parse_date.c.orig
+--- php-5.2.8/ext/date/lib/parse_date.c.orig	2008-12-07 20:31:16.000000000 +0100
++++ php5.2-200902121330/ext/date/lib/parse_date.c.orig	2009-02-12 14:51:26.000000000 +0100
+@@ -22483,7 +22483,7 @@
+ 
+ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
+ {
+-	if (!(options && TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
++	if (!(options & TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
+ 		parsed->h = 0;
+ 		parsed->i = 0;
+ 		parsed->s = 0;
+@@ -22503,7 +22503,7 @@
+ 		parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
+ 	}
+ 	if (!parsed->tz_info) {
+-		parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL;
++		parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
+ 	}
+ 	if (parsed->zone_type == 0 && now->zone_type != 0) {
+ 		parsed->zone_type = now->zone_type;
+diff -urN php-5.2.8/ext/date/lib/parse_date.re php5.2-200902121330/ext/date/lib/parse_date.re
+--- php-5.2.8/ext/date/lib/parse_date.re	2008-10-26 12:27:32.000000000 +0100
++++ php5.2-200902121330/ext/date/lib/parse_date.re	2008-12-18 16:43:49.000000000 +0100
+@@ -1619,7 +1619,7 @@
+ 
+ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
+ {
+-	if (!(options && TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
++	if (!(options & TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
+ 		parsed->h = 0;
+ 		parsed->i = 0;
+ 		parsed->s = 0;
+@@ -1639,7 +1639,7 @@
+ 		parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
+ 	}
+ 	if (!parsed->tz_info) {
+-		parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL;
++		parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
+ 	}
+ 	if (parsed->zone_type == 0 && now->zone_type != 0) {
+ 		parsed->zone_type = now->zone_type;
+diff -urN php-5.2.8/ext/date/lib/timelib.h php5.2-200902121330/ext/date/lib/timelib.h
+--- php-5.2.8/ext/date/lib/timelib.h	2008-02-22 10:48:18.000000000 +0100
++++ php5.2-200902121330/ext/date/lib/timelib.h	2008-12-31 12:46:14.000000000 +0100
+@@ -28,6 +28,7 @@
+ 
+ #define TIMELIB_NONE             0x00
+ #define TIMELIB_OVERRIDE_TIME    0x01
++#define TIMELIB_NO_CLONE         0x02
+ 
+ #define TIMELIB_SPECIAL_WEEKDAY  0x01
+ 
+diff -urN php-5.2.8/ext/date/lib/timelib_structs.h php5.2-200902121330/ext/date/lib/timelib_structs.h
+--- php-5.2.8/ext/date/lib/timelib_structs.h	2007-12-31 08:20:05.000000000 +0100
++++ php5.2-200902121330/ext/date/lib/timelib_structs.h	2008-12-31 12:46:14.000000000 +0100
+@@ -16,7 +16,7 @@
+ #ifndef __TIMELIB_STRUCTS_H__
+ #define __TIMELIB_STRUCTS_H__
+ 
+-#include <timelib_config.h>
++#include "timelib_config.h"
+ 
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+diff -urN php-5.2.8/ext/date/php_date.c php5.2-200902121330/ext/date/php_date.c
+--- php-5.2.8/ext/date/php_date.c	2008-12-02 19:01:57.000000000 +0100
++++ php5.2-200902121330/ext/date/php_date.c	2008-12-31 12:46:14.000000000 +0100
+@@ -1143,7 +1143,7 @@
+ 	t = timelib_strtotime(times, time_len, &error, DATE_TIMEZONEDB);
+ 	error1 = error->error_count;
+ 	timelib_error_container_dtor(error);
+-	timelib_fill_holes(t, now, 0);
++	timelib_fill_holes(t, now, TIMELIB_NO_CLONE);
+ 	timelib_update_ts(t, tzi);
+ 	ts = timelib_date_to_int(t, &error2);
+ 
================================================================


More information about the pld-cvs-commit mailing list