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 possible out-of-bounds read in endingToTxtSlice #1557

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Apr 19, 2024

  1. Update escapedStringOffset to improve readability

    This function was, admittedly, a little difficult to follow. This new
    version is slightly more verbose, but, in my opinion, easier to
    understand.
    janik-cloudflare committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    280787b View commit details
    Browse the repository at this point in the history
  2. Fix possible out-of-bounds read in endingToTxtSlice caused by escaped…

    …StringOffset
    
    If the input had a trailing backslash (normally the start of an escape
    sequence) with nothing following it, `escapedStringOffset` would return
    the length of the input, plus one (!), as the result index, causing an
    out-of-bounds read and panic in `endingToTxtSlice`.
    
    Consistent with, e.g., commit 2230854,
    I've decided to make this an error since it definitely indicates that
    the string isn't valid.
    
    Credit to OSS-Fuzz -- thank you!
    janik-cloudflare committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    5fd1579 View commit details
    Browse the repository at this point in the history