• Dan Elphick's avatar
    [ubsan] Make Isolate inherit from Factory · 5ed349d6
    Dan Elphick authored
    Previously Isolate and Factory relied on the undefined behavior of
    reinterpret_cast to switch between the two unrelated classes (which worked
    because Factory had no data members).
    
    With Isolate inheriting from Factory, it's now possible to switch between the
    two classes using c-style casts. These are allowed under the C++ standard.
    
    The inheritance is private which allows the continuing separation of the
    Factory and Isolate namespaces.
    
    This is a defensive clean-up, since ubsan does not yet detect the previous
    undefined behavior.
    
    Bug: v8:3770
    Change-Id: I0ccf09f1d34f747550812ce698ab7e182812409e
    Reviewed-on: https://chromium-review.googlesource.com/1010122Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Commit-Queue: Dan Elphick <delphick@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#52615}
    5ed349d6
isolate.h 67.1 KB