Skip to content

random: Initialize the mode field when seeding in php_random_default_status() #13690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

TimWolla
Copy link
Member

Unfortunately this is not really testable, as the used mode is not externally observable.


This is not just an issue due to missing initialization since moving the state struct directly into the module globals. In earlier versions changing the mode to MT_RAND_PHP within a single request would also affect the mode for subsequent requests.

Original commit message follows:

This is a follow-up fix for GH-13579. The issue was detected in the nightly MSAN build.

(cherry picked from commit bf0abd1)

…lt_status()` (php#13608)

This is not just an issue due to missing initialization since moving the state
struct directly into the module globals. In earlier versions changing the mode
to `MT_RAND_PHP` within a single request would also affect the mode for
subsequent requests.

Original commit message follows:

This is a follow-up fix for phpGH-13579. The issue was detected in the nightly
MSAN build.

(cherry picked from commit bf0abd1)
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TimWolla TimWolla merged commit f34721c into php:PHP-8.2 Mar 13, 2024
@TimWolla TimWolla deleted the random-reset-mt19937-mode branch March 13, 2024 19:14
TimWolla added a commit that referenced this pull request Mar 13, 2024
* PHP-8.2:
  random: Initialize the `mode` field when seeding in `php_random_default_status()` (#13690)
TimWolla added a commit that referenced this pull request Mar 13, 2024
* PHP-8.3:
  random: Initialize the `mode` field when seeding in `php_random_default_status()` (#13690)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants