-
Notifications
You must be signed in to change notification settings - Fork 110
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
[NCC-E005955-XVE] zebra-chain
: Inconsistent error management in Add
and Sub
for Height
#6279
Comments
Hey team! Please add your planning poker estimate with Zenhub @arya2 @conradoplg @dconnolly @oxarbitrage @teor2345 @upbqdn |
zebra-chain
: Inconsistent error management in Add
and Sub
for Height
zebra-chain
: Inconsistent error management in Add
and Sub
for Height
We don't think this panic is possible with valid However, since some code (particularly RPC code) might construct invalid heights, we're going to do some fixes anyway.
The output type is not a |
Do we need to review the estimate on this one? Seems like it ended up being bigger than a "size 2" issue. I don't necessarily want us to actually change the estimate retroactively but it might be interesting to discuss during the retro :) |
This refactor has already helped me discover a potential bug in my progress bar code. |
Motivation
We want to track all of the findings from the zebra audit.
Details
Some arithmetic operations for
Height
are implemented in zebra-chain/src/block/height.rs for bothHeight
andi32
zebra/zebra-chain/src/block/height.rs
Lines 68 to 100 in 5a88fe7
The
Add
function handles overflow with anOption
, butSub
will panic. TheSub
function later in the file fori32
subtraction returns anOption
as well, making the panic behavior an outlier. Panics should be used as a last resort, when there is no possibility of recovery. Otherwise, an attacker may attempt to intentionally trigger a panic as part of a denial-of-service attack. Additionally, theSub
function does not enforce the same constraint checks shown on Line 73 above, unlike the other functions in the same file.The text was updated successfully, but these errors were encountered: