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(core): error due to integer overflow when there are too many host bindings #38014

Closed

Commits on Jul 11, 2020

  1. fix(core): error due to integer overflow when there are too many host…

    … bindings
    
    We currently use 16 bits to store information about nodes in a view.
    The 16 bits give us 65536 entries in the array, but the problem is that while
    the number is large, it can be reached by ~4300 directive instances with host
    bindings which could realistically happen is a very large view, as seen in angular#37876.
    Once we hit the limit, we end up overflowing which eventually leads to a runtime error.
    
    These changes bump to using 20 bits which gives us around 1048576 entries in
    the array or 16 times more than the current amount which could still technically
    be reached, but is much less likely and the user may start hitting browser limitations
    by that point.
    
    I picked the 20 bit number since it gives us enough buffer over the 16 bit one,
    while not being as massive as a 24 bit or 32 bit.
    
    I've also added a dev mode assertion so it's easier to track down if it happens
    again in the future.
    
    Fixes angular#37876.
    crisbeto committed Jul 11, 2020
    Configuration menu
    Copy the full SHA
    a883497 View commit details
    Browse the repository at this point in the history