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

plumbing: gitattributes, Avoid index out of range #598

Merged
merged 1 commit into from Nov 7, 2022

Commits on Oct 12, 2022

  1. plumbing: gitattributes, Avoid index out of range

    When a path is deeper than the single asterisk pattern the code would
    crash with a "index out of range".
    
    This change checks the length of the remaining pattern before it
    references an element of that slice.
    
    With a single trailing asterisk paths deeper than the pattern should not
    get the attributes.
    
    For example with the following `.gitattributes` file:
    
        thirdparty/* linguist-vendored
    
    This is how git handles it:
    
        $ git check-attr --all thirdparty/README.md
    
        thirdparty/README.md: diff: markdown
        thirdparty/README.md: linguist-vendored: set
    
        $ git check-attr --all thirdparty/package/README.md
    
        thirdparty/package/README.md: diff: markdown
    To1ne committed Oct 12, 2022
    Copy the full SHA
    7dd5d8f View commit details
    Browse the repository at this point in the history