From: Anatol Belski Date: Fri, 1 Jul 2016 16:41:50 +0000 (+0200) Subject: Fixed bug #72498 variant_date_from_timestamp null dereference X-Git-Tag: php-7.0.9RC1~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3455848dfe246fed61ca715cc79254c153f0f3eb;p=php Fixed bug #72498 variant_date_from_timestamp null dereference --- diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index 58ba3f154c..6a5dc9dacb 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -1007,6 +1007,13 @@ PHP_FUNCTION(variant_date_from_timestamp) tzset(); ttstamp = timestamp; tmv = localtime(&ttstamp); +#if ZEND_ENABLE_ZVAL_LONG64 + /* Invalid after 23:59:59, December 31, 3000, UTC */ + if (!tmv) { + php_error_docref(NULL, E_WARNING, "Invalid timestamp " ZEND_LONG_FMT, timestamp); + RETURN_FALSE; + } +#endif memset(&systime, 0, sizeof(systime)); systime.wDay = tmv->tm_mday; diff --git a/ext/com_dotnet/tests/bug72498.phpt b/ext/com_dotnet/tests/bug72498.phpt new file mode 100644 index 0000000000..e155735ba5 --- /dev/null +++ b/ext/com_dotnet/tests/bug72498.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #72498 variant_date_from_timestamp null dereference +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: variant_date_from_timestamp(): Invalid timestamp %d in %sbug72498.php on line %d +bool(false)