regex: Plug a regex literal crash#11938
Conversation
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR fixes a crash in regex pattern parsing by preventing out-of-bounds access when validating pattern delimiters on short inputs. A length guard is added before delimiter detection, and comprehensive test cases document expected behavior for edge cases including single-slash and literal-slash patterns. ChangesRegex Pattern Delimiter Parsing Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This Windows ARM64 fail https://github.com/fluent/fluent-bit/actions/runs/27324468341/job/80722539551?pr=11938 will be resolved with: |
| struct flb_regex *regex = NULL; | ||
| int ret; | ||
|
|
||
| regex = flb_regex_create("//tmp//"); |
There was a problem hiding this comment.
Hmm, so we have to use // to get one slash - should we have a different delimiter, e.g. \/?
Just worried we will end up with the nightmare of Java regexes and string escaping otherwise, e.g. if we want two slashes you have to have four, not three, etc.
Closes #11937.
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit
Bug Fixes
Tests