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

src: replace unreachable code with static_assert #46209

Merged

Commits on Jan 14, 2023

  1. src: replace unreachable code with static_assert

    This function base64-decodes a given JavaScript string to obtain the
    secret key, whose length must not exceed INT_MAX. However, because
    JavaScript strings are limited to v8::String::kMaxLength chars and
    because base64 decoding never yields more bytes than input chars, the
    size of the decoded key must be strictly less than
    v8::String::kMaxLength bytes. Therefore, it is sufficient to statically
    assert that String::kMaxLength <= INT_MAX (which is always true because
    String::kMaxLength itself is an int).
    
    Aside from being unreachable, Coverity considers the current code
    "suspicious" because it indicates that buffers larger than INT_MAX might
    actually be allocated.
    tniessen committed Jan 14, 2023
    Copy the full SHA
    07aa9af View commit details
    Browse the repository at this point in the history