-
Notifications
You must be signed in to change notification settings - Fork 45
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
Truncate values when storing to stack based on width #844
Conversation
Signed-off-by: Alan Jowett <[email protected]>
WalkthroughThe changes modify the Changes
Possibly related PRs
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
src/crab/ebpf_transformer.cpp
(2 hunks)test-data/stack.yaml
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: build_windows (Release, library)
- GitHub Check: build_windows (Release, tests)
- GitHub Check: build_ubuntu (Release, tests)
- GitHub Check: build_windows (Debug, library)
- GitHub Check: build_windows (Debug, tests)
- GitHub Check: build_ubuntu (Debug, tests)
- GitHub Check: build_ubuntu (Release)
- GitHub Check: build_ubuntu (Debug)
- GitHub Check: Analyze (cpp)
🔇 Additional comments (5)
test-data/stack.yaml (3)
593-594
: New test section added correctly.The YAML structure follows proper indentation and uses the same formatting as the rest of the test file.
596-615
: Good test case for verifying 64-bit round trip storage.This test correctly validates that a min int (-2147483648) can be stored and retrieved from the stack with proper value preservation.
637-655
: Verify expected behavior with 32-bit truncation.This test correctly verifies that a min int (-2147483648) truncated to 32 bits results in 2147483648 as both signed and unsigned values when retrieved.
src/crab/ebpf_transformer.cpp (2)
982-987
: Added 16-bit and 8-bit support for overflow handling.The code now properly handles 16-bit and 8-bit finite widths in the overflow_signed function by using appropriate span values from std::numeric_limits.
991-996
: Added 16-bit and 8-bit support for unsigned overflow handling.Similar to the signed case, the overflow_unsigned function now supports 16-bit and 8-bit widths properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but can be refactored.
Signed-off-by: Alan Jowett <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/crab/ebpf_transformer.cpp
(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: build_windows (Release, library)
- GitHub Check: build_windows (Release, tests)
- GitHub Check: build_ubuntu (Release, tests)
- GitHub Check: build_windows (Debug, library)
- GitHub Check: build_windows (Debug, tests)
- GitHub Check: build_ubuntu (Debug, library)
- GitHub Check: build_ubuntu (Debug, tests)
- GitHub Check: build_ubuntu (Release)
- GitHub Check: build_ubuntu (Debug)
- GitHub Check: Analyze (cpp)
🔇 Additional comments (2)
src/crab/ebpf_transformer.cpp (2)
982-984
: Updated overflow_signed to use the simplified interface.Function call updated to match the new signature, removing the unnecessary span calculation.
986-988
: Updated overflow_unsigned to use the simplified interface.Function call updated to match the new signature, removing the unnecessary span calculation.
Resolves: #841
When storing values on the stack with width != 8, it is neccessary to truncate the value to the width of the stack variables.
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Tests