Skip to content

"slice bounds out of range" in glob.matchElement #1220

Closed

Description

@mrlzh

Reappearance:
Decoding tCsrMDMyM9X4pf7r5w== with Base64 as filename and creating a file.

Executing the 'ls *.a' command causes a crash

panic: runtime error: slice bounds out of range [14:13]

goroutine 170 [running]:
github.com/elves/elvish/pkg/glob.matchElement(0xc000393960, 0x2, 0x2, 0xc0003bf598, 0xd, 0x0)
        /Users/testingliu/Desktop/elvish-0.14.1/pkg/glob/glob.go:238 +0x716

Activity

  1. xiaq commented on Jun 8, 2021

    @xiaq
    Member

    The issue is now fixed, but I thought I'd share some interesting facts I found when trying to test this:

    • macOS will not create a file whose name has invalid UTF-8 sequences.
    • Windows pretends to, but substitutes the invalid sequence with U+FFFD.
    • Linux seems to be the only OS that would happily create a file whose name contains anything but NUL.
  2. added a commit that references this issue on Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions