You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It then loops over block's transactions, but indexes into block1. If block and block1 are identical blocks, this should be fine. But if block has more transactions than block1, which could occur if there's a reorg at just the right time, it will index out of bounds into block1 and crash.
Suggested fix: Make the verbose call to getblock first (to get block1), then fetch the block using getblock <hash> (to get block). Using the hash prevents fetching a different block. The reorg-handling logic elsewhere in lightwalletd will deal with the reorg.
There's a race condition that can cause a lightwalletd crash when a reorg occurs at just the right time.
getBlockFromRPC
first callsgetblock
to get the block into theblock
variable:lightwalletd/common/common.go
Lines 267 to 268 in 2d3943b
Then, it makes another call to
getblock
and puts the block data into theblock1
variable:lightwalletd/common/common.go
Lines 285 to 291 in 2d3943b
It then loops over
block
's transactions, but indexes intoblock1
. Ifblock
andblock1
are identical blocks, this should be fine. But ifblock
has more transactions thanblock1
, which could occur if there's a reorg at just the right time, it will index out of bounds intoblock1
and crash.lightwalletd/common/common.go
Lines 295 to 296 in 2d3943b
The data here is coming from zcashd, so this crash can not be triggered intentionally to DoS the server.
The text was updated successfully, but these errors were encountered: