[php-src] PR #21591: Fix GH-21545: PHP OpenSSL ext: openssl_x509_parse miscalculates validTo_time_t for far-future certificate dates
| From: | LamentXU123 | Date: | Wed, 01 Apr 2026 01:35:32 +0000 |
| Subject: | [php-src] PR #21591: Fix GH-21545: PHP OpenSSL ext: openssl_x509_parse miscalculates validTo_time_t for far-future certificate dates | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35457@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21591
Author: LamentXU123
Fix #21545
After looking at the code closely I *think* the bug is caused by
mktime()
[here](https://github.com/php/php-src/blob/master/ext/openssl/openssl_backend_common.c#L191). In
Windows, mktime() could only produce time smaller than 2038 or 3000 depending on x32 or
x64 system
([doc](https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/mktime-mktime32-mktime64?f_link_type=f_linkinlinenote&flow_extra=eyJpbmxpbmVfZGlzcGxheV9wb3NpdGlvbiI6MCwiZG9jX3Bvc2l0aW9uIjowLCJkb2NfaWQiOiI2MTYxOTY2YWIzMDc4ODQ0LTlmODFjMDY0YTk0MjA2NzMifQ%3D%3D&view=msvc-160)),
and when dealing with far-future certificate dates it suffers from an overflow bug.
This patch implement the same function without using mktime()