[php-src] PR #25970: Fix GH-25967: umask() narrows out-of-range values to int
| From: | sanketpatel32 | Date: | Mon, 30 Nov 2026 19:03:01 +0000 |
| Subject: | [php-src] PR #25970: Fix GH-25967: umask() narrows out-of-range values to int | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41277@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25970
Author: sanketpatel32
## Summary
Fixes #25967.
umask() now validates an explicitly provided mask before probing or changing the
process umask. Values outside 0..0777 throw ValueError, so large
zend_long values no longer narrow through (int) and inadvertently clear or
alter the process mask; the prior mask and BG(umask) bookkeeping remain untouched on
the error path.
This targets master because rejecting invalid input with a new ValueError
is a behavior change. It can be backported to the lowest supported bugfix branch if the maintainers
prefer.
Adds ext/standard/tests/file/gh25967.phpt covering 4294967296,
-1, and a valid mask while asserting the prior mask is preserved.
## Tests
- ./buildconf && ./configure --disable-all --enable-debug && make
-j$(nproc)
- make test TESTS=ext/standard/tests/file/ — 915 tests: 624 passed, 291 skipped, 0
failed