Linear-time binary glob matcher.
Uses a two-pointer algorithm that avoids exponential backtracking on
patterns like *a*a*a*a*b (CVE-2022-36021, CVE-2024-31228).
Supports:
*-- matches zero or more bytes?-- matches exactly one byte[abc]-- character class (matches any single listed byte)[^abc]/[!abc]-- negated character class\-- escape next character (treat literally)- All other bytes match literally
Examples
iex> Ferricstore.GlobMatcher.match?("hello", "h*o")
true
iex> Ferricstore.GlobMatcher.match?("hello", "h?llo")
true
iex> Ferricstore.GlobMatcher.match?("hello", "world")
false
Summary
Functions
Returns true if subject matches the glob pattern.