diff options
| author | Derick Rethans <derick@php.net> | 2008-12-18 14:55:36 +0000 |
|---|---|---|
| committer | Derick Rethans <derick@php.net> | 2008-12-18 14:55:36 +0000 |
| commit | aea378c91c4a4f4a77fcbef0f0c577e5b2a0486c (patch) | |
| tree | b6155d810fd590532349df87a9bdcbcad5687e43 | |
| parent | 47769245adf76978e3e1ba46be3e581c287f19c3 (diff) | |
| download | php-git-aea378c91c4a4f4a77fcbef0f0c577e5b2a0486c.tar.gz | |
- MFH: Fixed bug #46889: Memory leak in strtotime().
| -rw-r--r-- | ext/date/lib/parse_date.c | 6 | ||||
| -rw-r--r-- | ext/date/lib/parse_date.re | 4 | ||||
| -rw-r--r-- | ext/date/lib/timelib.h | 1 | ||||
| -rw-r--r-- | ext/date/php_date.c | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 8a2f34a247..f99e6ff59c 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Wed Nov 5 11:44:09 2008 */ +/* Generated by re2c 0.13.5 on Thu Dec 18 14:58:43 2008 */ #line 1 "ext/date/lib/parse_date.re" /* +----------------------------------------------------------------------+ @@ -24232,7 +24232,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim 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; @@ -24252,7 +24252,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options) 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 --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index 812d16b558..049685dd4a 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -2089,7 +2089,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim 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; @@ -2109,7 +2109,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options) 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 --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h index f23978f89a..432792349d 100644 --- a/ext/date/lib/timelib.h +++ b/ext/date/lib/timelib.h @@ -28,6 +28,7 @@ #define TIMELIB_NONE 0x00 #define TIMELIB_OVERRIDE_TIME 0x01 +#define TIMELIB_NO_CLONE 0x02 #define TIMELIB_SPECIAL_WEEKDAY 0x01 #define TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH 0x02 diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 2cca079a31..1ddc6a57e0 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1388,7 +1388,7 @@ PHP_FUNCTION(strtotime) 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); |
