Repository navigation
Conversation
parseValueExpression() skipped "+" with `continue` before consuming it, so the next iteration saw "+" again at i == 1 and rejected the whole pattern. "u8(+5)" and "u16be(+258)" were invalid while "s16(-2)" worked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem description
In the Find view's binary pattern syntax, a value with a leading
+is rejected.u8(+5)andu16be(+258)are invalid, buts16(-2)works.parseValueExpression()handles+withcontinuebefore it consumes the character. On the next iterationiis 1, the same+is not a digit, and the whole pattern is rejected.Implementation description
Handle
+like-: consume it and setnegativefrom it. NewBinaryPatternValueWithSigntest intests/helpers/source/binary_pattern.cpp.Screenshots
None. There is no UI change.
Additional things
I couldn't do a full ImHex build here (Windows without MSYS2). I compiled the unchanged
binary_pattern.cppwith zig c++ (clang, C++23) and linked it into a small harness that runs the same checks as the new test. 3 checks fail on master and all pass with the fix. The new test file compiles against the realtests.hpp, but CI is the first run of it insidehelpers_test.I used Claude Code to write this change.