com php-src: Fixed bug #72498 variant_date_from_timestamp null dereference: ext/com_dotnet/com_variant.c ext/com_dotnet/tests/bug72498.phpt

From: Date: Fri, 01 Jul 2016 16:41:50 +0000
Subject: com php-src: Fixed bug #72498 variant_date_from_timestamp null dereference: ext/com_dotnet/com_variant.c ext/com_dotnet/tests/bug72498.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92728@lists.php.net to get a copy of this message
Commit: 3455848dfe246fed61ca715cc79254c153f0f3eb Author: Anatol Belski <ab@php.net> Fri, 1 Jul 2016 18:41:50 +0200 Parents: 9b8f1d6037a0cee0bd7d002925ab54bcaec25eb9 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3455848dfe246fed61ca715cc79254c153f0f3eb Log: Fixed bug #72498 variant_date_from_timestamp null dereference Bugs: https://bugs.php.net/72498 Changed paths: M ext/com_dotnet/com_variant.c A ext/com_dotnet/tests/bug72498.phpt Diff: diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index 58ba3f1..6a5dc9d 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 0000000..e155735 --- /dev/null +++ b/ext/com_dotnet/tests/bug72498.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #72498 variant_date_from_timestamp null dereference +--SKIPIF-- +<?php # vim:ft=php +if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; +if (PHP_INT_SIZE != 8) print "skip 64-bit only"; +?> +--FILE-- +<?php + +$v1 = PHP_INT_MAX; +var_dump(variant_date_from_timestamp($v1)); +?> +--EXPECTF-- +Warning: variant_date_from_timestamp(): Invalid timestamp %d in %sbug72498.php on line %d +bool(false)

« previous php.cvs (#92728) next »