code-423n4 / 2023-12-revolutionprotocol-findings

3 stars 2 forks source link

Input Validation #688

Closed c4-bot-3 closed 9 months ago

c4-bot-3 commented 10 months ago

Lines of code

https://github.com/code-423n4/2023-12-revolutionprotocol/blob/d42cc62b873a1b2b44f57310f9d4bbfdd875e8d6/packages/revolution/src/MaxHeap.sol#L78

Vulnerability details

Your require statement checks that pos is not equal to 0, which is a good check to ensure that you don't attempt to find the parent of the root node. However, you might also want to check if pos is an even number (assuming the binary tree structure is zero-indexed), as odd-numbered positions should not have a left child. This additional check can further improve the safety of the function.

require(pos != 0, "Position should not be zero"); require(pos % 2 == 0, "Position should be an even number");

Assessed type

Invalid Validation

c4-pre-sort commented 10 months ago

raymondfam marked the issue as insufficient quality report

c4-pre-sort commented 10 months ago

raymondfam marked the issue as primary issue

raymondfam commented 10 months ago

Insufficient proof.

c4-judge commented 9 months ago

MarioPoneder marked the issue as unsatisfactory: Insufficient quality