[php-src] PR #16437: Fix GH-16433: Large values for openssl_csr_sign() $days overflow
| From: | cmb69 | Date: | Mon, 14 Oct 2024 13:54:13 +0000 |
| Subject: | [php-src] PR #16437: Fix GH-16433: Large values for openssl_csr_sign() $days overflow | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-29235@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/16437
Author: cmb69
The
offset_sec parameter of X509_gmtime_adj() expects a long,
but the $days parameter of openssl_csr_sign() a zend_long.
We must avoid signed integer overflow (UB), but also must not silently truncate. Thus we check the
given $days for the permissible range, and bail out otherwise.
---
Note that the lower bound (0) is somewhat arbitrary; we could allow values >=
LONG_MIN / 86400. I don't know if that makes sense, though (maybe for testing
purposes?)
Also note that I've used E_WARNING for consistency with the rest, but that should
probably propagated to a ValueError.