Skip to content

fix: Add overflow protection to Fibonacci implementation#371

Merged
sjudson merged 3 commits intonexus-xyz:mainfrom
DeVikingMark:fib-rs
Apr 2, 2025
Merged

fix: Add overflow protection to Fibonacci implementation#371
sjudson merged 3 commits intonexus-xyz:mainfrom
DeVikingMark:fib-rs

Conversation

@DeVikingMark
Copy link
Contributor

Description:

  • Fix edge case handling for n=1
  • Add overflow protection using checked_add
  • Return u32::MAX on overflow instead of panicking

It prevents potential integer overflow vulnerabilities in the zkVM test suite while maintaining backwards compatibility.

CreeptoGengar pushed a commit to CreeptoGengar/nexus-zkvm that referenced this pull request Mar 14, 2025
* WIP

* add benchmarking

* fmt

* fix

* x

* Update tests/testing-framework/src/emulator.rs

Co-authored-by: duc-nx <duc@nexus.xyz>

* comments + wrapper function for serialization/assertions

* fix

* Update tests/testing-framework/Cargo.toml

Co-authored-by: Ben Hoberman <bhoberman@users.noreply.github.com>

* Update .gitignore

Co-authored-by: Ben Hoberman <bhoberman@users.noreply.github.com>

* rebase fix

* fix test

* fmt

* fmt

* fix

* fix

* x

* harvard

* revise

---------

Co-authored-by: duc-nx <duc@nexus.xyz>
Co-authored-by: Ben Hoberman <bhoberman@users.noreply.github.com>
@sjudson
Copy link
Contributor

sjudson commented Mar 28, 2025

@DeVikingMark Thanks for the fixes. As part of our new licensing, we require signing a contributor license agreement in order to contribute to the the codebase.

If you rebase this PR off main the bot will activate and walk you through the (very straightforward) process to sign the CLA.

@github-actions
Copy link

github-actions bot commented Mar 29, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@DeVikingMark
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@DeVikingMark
Copy link
Contributor Author

@DeVikingMark Thanks for the fixes. As part of our new licensing, we require signing a contributor license agreement in order to contribute to the the codebase.

If you rebase this PR off main the bot will activate and walk you through the (very straightforward) process to sign the CLA.

@sjudson yeah sure, I signed it

Copy link
Contributor

@sjudson sjudson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retracting my review, seems like the tests that use this program are now failing.

@DeVikingMark
Copy link
Contributor Author

Retracting my review, seems like the tests that use this program are now failing.

@sjudson May I ask you to have a look at it now? I suppose it should be fine, but if it's not, I'll try to seek deeper the problem

Copy link
Contributor

@sjudson sjudson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix.

@sjudson sjudson merged commit 9524f16 into nexus-xyz:main Apr 2, 2025
8 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants