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

fix: Only consider salient bytes in sharecommon eq, hash #5840

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Oct 25, 2024

  1. [sharecommon] Only consider salient bytes in eq, hash

    Change "lean_sharecommon_{eq,hash}" to only consider the salient bytes
    of an object, and not any bytes of any unspecified/uninitialized unused
    capacity.
    
    Accessing uninitialized storage results in undefined behaviour.
    
    This does not seem to have any semantics disadvantages: If objects
    compare equal after this change, their salient bytes are still
    equal. By contrast, if the actual identity of allocations needs to be
    distinguished, that can be done by just comparing pointers to the
    storage.
    
    If we wanted to retain the current logic, we would need initialize the
    otherwise unused parts to some specific value to avoid the undefined
    behaviour.
    tkoeppe committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    104e413 View commit details
    Browse the repository at this point in the history