Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: moby/patternmatcher
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 347bb8d
Choose a base ref
...
head repository: moby/patternmatcher
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5a6d842
Choose a head ref
  • 4 commits
  • 4 files changed
  • 3 contributors

Commits on Mar 23, 2026

  1. ci: update actions and test against "oldest", "oldstable" and "stable"

    Signed-off-by: Sebastiaan van Stijn <[email protected]>
    thaJeztah committed Mar 23, 2026
    Configuration menu
    Copy the full SHA
    a95e09c View commit details
    Browse the repository at this point in the history
  2. Merge pull request #8 from thaJeztah/update_ci

    ci: update actions and test against "oldest", "oldstable" and "stable"
    thaJeztah authored Mar 23, 2026
    Configuration menu
    Copy the full SHA
    7f236f5 View commit details
    Browse the repository at this point in the history
  3. fix panic / nil pointer dereference on invalid patterns

    `Pattern.compile` was updating `Pattern.matchType` in-place. In situations where
    the resulting regex failed to compile, it would return early (with an error),
    but the `matchType` was already set.
    
    In that situation, `Pattern.match` would consider the `matchType` already
    set, skip the `p.matchType == unknownMatch` condition, and fall through
    to trying to use `p.regex`, which was nil, and resulted in a panic;
    
    ```
    journalctl -u docker.service -f
    dockerd[423967]: panic: runtime error: invalid memory address or nil pointer dereference
    dockerd[423967]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x90 pc=0x557e0f7ebf80]
    dockerd[423967]: goroutine 1241 [running]:
    dockerd[423967]: regexp.(*Regexp).doExecute(0x557e11b285a0?, {0x0?, 0x0?}, {0x0?, 0x557e11922650?, 0x557e11922650?}, {0xc0009d3db0?, 0xc000061778?}, 0x557e0f6d0d99?, 0x0, ...)
    dockerd[423967]:         /usr/local/go/src/regexp/exec.go:527 +0x80
    dockerd[423967]: regexp.(*Regexp).doMatch(...)
    dockerd[423967]:         /usr/local/go/src/regexp/exec.go:514
    dockerd[423967]: regexp.(*Regexp).MatchString(...)
    dockerd[423967]:         /usr/local/go/src/regexp/regexp.go:527
    dockerd[423967]: github.com/moby/patternmatcher.(*Pattern).match(0x557e11922650?, {0xc0009d3db0, 0x1})
    dockerd[423967]:         /root/build-deb/engine/vendor/github.com/moby/patternmatcher/patternmatcher.go:334 +0x26b
    dockerd[423967]: github.com/moby/patternmatcher.(*PatternMatcher).MatchesOrParentMatches(0xc000d761e0, {0xc0009d3db0, 0x1})
    dockerd[423967]:         /root/build-deb/engine/vendor/github.com/moby/patternmatcher/patternmatcher.go:142 +0xda
    dockerd[423967]: github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb.validateCopySourcePath({0xc0009d3db0, 0x1}, 0xc0000621f8)
    dockerd[423967]:         /root/build-deb/engine/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go:2023 +0x55
    dockerd[423967]: github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb.dispatchCopy(_, {{{0xc0009d3dc0, 0x1}, {0xc0009b5d10, 0x1, 0x1}, {0x0, 0x0, 0x0}}, {0x0, ...}, ...})
    dockerd[423967]:         /root/build-deb/engine/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go:1607 +0xd5c
    dockerd[423967]: github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb.dispatch(_, {{_, _}, {_, _, _}, _}, {0xc000aab6a0, {0x557e1214c560, 0xc0007b79e0}, ...})
    dockerd[423967]:         /root/build-deb/engine/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go:1004 +0xafb
    dockerd[423967]: github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb.toDispatchState({_, _}, {_, _, _}, {{0xc000d5c8d0, {0x0, 0x0}, {0x0, 0x0}, ...}, ...})
    dockerd[423967]:         /root/build-deb/engine/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go:731 +0x3926
    dockerd[423967]: github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb.Dockerfile2LLB({_, _}, {_, _, _}, {{0xc000d5c8d0, {0x0, 0x0}, {0x0, 0x0}, ...}, ...})
    dockerd[423967]:         /root/build-deb/engine/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go:90 +0x65
    dockerd[423967]: github.com/moby/buildkit/frontend/dockerfile/builder.Build.func6({0x557e121613e0, 0xc000cfd590}, 0x0, 0x557e0f64accb?)
    dockerd[423967]:         /root/build-deb/engine/vendor/github.com/moby/buildkit/frontend/dockerfile/builder/build.go:136 +0xfe
    dockerd[423967]: github.com/moby/buildkit/frontend/dockerui.(*Client).Build.func1()
    dockerd[423967]:         /root/build-deb/engine/vendor/github.com/moby/buildkit/frontend/dockerui/build.go:39 +0x71
    dockerd[423967]: golang.org/x/sync/errgroup.(*Group).Go.func1()
    dockerd[423967]:         /root/build-deb/engine/vendor/golang.org/x/sync/errgroup/errgroup.go:93 +0x50
    dockerd[423967]: created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1136
    dockerd[423967]:         /root/build-deb/engine/vendor/golang.org/x/sync/errgroup/errgroup.go:78 +0x95
    systemd[1]: docker.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
    systemd[1]: docker.service: Failed with result 'exit-code'.
    ```
    
    This patch:
    
    - updates `Pattern.compile` to use a local variable for the intermediate
      state, and only updates `Pattern.matchType` when completing successfully.
    - adds a nil-check in `Pattern.match` as defense-in-depth.
    
    Signed-off-by: Sebastiaan van Stijn <[email protected]>
    thaJeztah committed Mar 23, 2026
    Configuration menu
    Copy the full SHA
    e5d80c7 View commit details
    Browse the repository at this point in the history

Commits on Mar 24, 2026

  1. Merge pull request #9 from thaJeztah/fix_panic

    fix panic /  nil pointer dereference on invalid patterns
    tonistiigi authored Mar 24, 2026
    Configuration menu
    Copy the full SHA
    5a6d842 View commit details
    Browse the repository at this point in the history
Loading