Skip to content
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

Avoid accessing uninitialized settings in own init #11117

Merged
merged 1 commit into from
Jul 17, 2024

Commits on Jul 16, 2024

  1. Avoid accessing uninitialized settings in own init

    The default value for the setting was evaluated by
    calling a method on the object _being currently constructed_,
    so we were using it before all fields were initialized.
    
    This has been fixed by making the called method static,
    and not using the previously used fields at all.
    
    But functionality hasn't changed!
    The fields were usually always zero (by chance?) anyway,
    meaning the conditional path was always taken.
    
    Thus the current logic has been kept, the code simplified,
    and UB removed.
    
    This was found with the helper of UBSan.
    L-as committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    91b4452 View commit details
    Browse the repository at this point in the history