Thanks for the proposal but I prefer to let you choose how to fix this since it is dependent of the business logic.
My fix was just for testing to verify that the nil pointer deref was coming from this function. It's not taking care if this function should actually return false in that case, or if you should verify v and v.validator in the caller function.
Description
During fuzzing with beaconfuzz, I found the following bug:
what:
panic: runtime error: invalid memory address or nil pointer dereference
where: in
prysm
how: triggered during
ProposerSlashing
processing.The bug is happening mainly in
VerifyProposerSlashing
function.Here is some supposition:
prysm/beacon-chain/core/blocks/block_operations.go
Lines 426 to 432 in a0bf8cb
proposer
will benil
after the call toValidatorAtIndexReadOnly
IsSlashableValidatorUsingTrie
is called with proposerprysm/beacon-chain/core/helpers/validators.go
Lines 50 to 51 in 9a11574
IsSlashableValidatorUsingTrie
will executeval.Slashed()
(val
==proposer
)prysm/beacon-chain/state/getters.go
Lines 76 to 79 in 6a9112b
Slashed
try to dereferencev.validator
without having verify thatv
andv.validator
are notnil
Download: panic_nil_deref_prysm_proposer.zip
I can only reproduce the bug running my fuzzer with the previous crashing ssz file.
Maybe you will succeed to reproduce with your fuzzers as well.
Fuzzing function:
I have nevertheless fix the bug (with the following patch) and the fuzzer is not crashing anymore.
Patch
A simple fix consist to check if
v
andv.validator
arenil
like inWithdrawableEpoch()
andExitEpoch()
functions.instead of:
prysm/beacon-chain/state/getters.go
Lines 77 to 79 in 6a9112b
Operating System:
OS: Ubuntu 18.04
Go: Go 1.14
What version of Prysm are you running? (Which release)
master
commit: d152b48
The text was updated successfully, but these errors were encountered: