parser:add minimal limit for col & lnum #503
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
The change helps to avoid col and lnum values less than 0.
I faced problems with cppcheck 2.12.0. It can report zero line/column number if a problem is located at the beginning of a file. After applying offsets, the value(s) can be < 0, triggering errors in other places. For example, in trouble.nvim plugin because it can't jump on an invalid source location. The limiting of minimal values helped with the problem.
Here is example of cppcheck report with line/column = 0
Here is trouble.nvim error message, because it interprets the issue position as line 0 and column 0.

After applying changes, the position becomes valid. Jumping/navigation works fine.

Please feel free to ask for additional modifications/information.
Thank you