-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Panic with --crlf due to integer underflow #1765
Comments
Thanks! Yeah, I stripped debug info from ripgrep binaries, which means stack traces are essentially useless from the release binaries. I should probably remove that from the issue template or request folks to compile ripgrep themselves with debug info. But in this case, the reproduction was simple enough:
Looks like it's just a simple bug where I assumed ripgrep/crates/printer/src/standard.rs Lines 1471 to 1480 in a6d0547
|
This fixes a bug where it was assumed that 'is_suffix' when CRLF handling was enabled mean that '\r\n' was present. But that's not the case, and it is intentional that 'is_suffix' only looks for '\n'. (Which is why #1803 wasn't taken, which tries to fix this by changing 'is_suffix'.) Fixes #1765, Closes #1803
This fixes a bug where it was assumed that 'is_suffix' when CRLF handling was enabled mean that '\r\n' was present. But that's not the case, and it is intentional that 'is_suffix' only looks for '\n'. (Which is why #1803 wasn't taken, which tries to fix this by changing 'is_suffix'.) Fixes #1765, Closes #1803
This fixes a bug where it was assumed that 'is_suffix' when CRLF handling was enabled mean that '\r\n' was present. But that's not the case, and it is intentional that 'is_suffix' only looks for '\n'. (Which is why #1803 wasn't taken, which tries to fix this by changing 'is_suffix'.) Fixes #1765, Closes #1803
What version of ripgrep are you using?
ripgrep 12.1.1 (rev 7cb2113)
-SIMD -AVX (compiled)
+SIMD -AVX (runtime)
How did you install ripgrep?
scoop install ripgrep
What operating system are you using ripgrep on?
Windows 10 Build 19041
Describe your bug.
With some regexes, combining --crlf with input that contains unix line endings causes a panic.
What are the steps to reproduce the behavior?
Minimal repro:
Don't forget that
echo ''
writes a line terminator:What is the actual behavior?
You'll be disappointed with the stack trace, but I'm including it anyway, as requested
What is the expected behavior?
ripgrep should not panic.
The text was updated successfully, but these errors were encountered: