You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running Bearer with the --diff option and the scanner encounters an error it will return a Error: signal: broken pipe. This is because the error is not checked before returning from the parseDiff function.
Example command: go run ./cmd/bearer/main.go scan ~/code/repo-with-long-line-diff --diff
An example error would be a diff that contains a line longer than the MaxScanTokenSize. (64 * 1024 bytes). With this additional code, the returned error will be Error: bufio.Scanner: token too long.
Expected Behavior
The scan completes successfully.
Actual Behavior
> go run ./cmd/bearer/main.go scan ~/code/repo/ --diff
Analyzing codebase
⠹ (58264/-) [0s]
Loading rules
Scanning target ~/code/repo/
2024-02-21 16:45:28 ERR Git discovery failed process=main
Error: bufio.Scanner: token too long
exit status 1
Description & Reproduction
When running Bearer with the
--diff
option and the scanner encounters an error it will return aError: signal: broken pipe
. This is because the error is not checked before returning from theparseDiff
function.Example command:
go run ./cmd/bearer/main.go scan ~/code/repo-with-long-line-diff --diff
An example error would be a diff that contains a line longer than the MaxScanTokenSize. (64 * 1024 bytes). With this additional code, the returned error will be
Error: bufio.Scanner: token too long
.Expected Behavior
The scan completes successfully.
Actual Behavior
Possible Fix
Proposed PR to address error
Instead of a
bufio.Scanner
use aReader
. Looks like you might have some utils that handle this already.Your Environment
The text was updated successfully, but these errors were encountered: