fix: resolve arithmetic overflow in capture.rs #2
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.
Hi Metaplex Team,
I discovered a potential arithmetic overflow issue in the
capture.rs
file. This issue can occur in the following code line:mpl-hybrid/programs/mpl-hybrid/src/instructions/capture.rs
Lines 139 to 140 in 6376558
When a
uint64
type variable is multiplied by anotheruint64
value, the result may exceed the maximum value of theuint64
type, causing a program panic. The overflow can cause transactions that enableon-chain metadata updates
for collections to fail during the execution of thecapture_v1
function. Here's a detailed reproduction of the issue:https://explorer.solana.com/tx/2cgKF1g5mCjgxkfPYRvi26Qqw4z9zRmx3ybA5WUfywGYZZzG4UWXz6VufNPdzFvfrZDyFgUWfKmFG43Ke1bdWNm?cluster=devnet
To resolve this issue, the best approach is to remove "
* escrow.count
". This fix ensures the arithmetic operation remains within safe bounds, preventing potential crashes.Regarding the Bounty Program, I noticed there is no specific mention of a reward for bugs related to mpl-hybrid. If there is a bounty available for this fix, please send the reward to the following Solana address:
72SebYpPzemzf4h7g52dgCc4awKgmHnoRmn8PLpP8MaK
.Thank you for your attention to this matter.