From f627ff2383b791008d90999ab0d98a1984f54ed3 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Wed, 8 Jan 2020 18:20:22 +0100 Subject: [PATCH 1/2] Verify RLE+ counts Signed-off-by: Jakub Sztandera --- chain/actors/actor_miner.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/chain/actors/actor_miner.go b/chain/actors/actor_miner.go index 54076cac8..4e3e33096 100644 --- a/chain/actors/actor_miner.go +++ b/chain/actors/actor_miner.go @@ -24,6 +24,7 @@ import ( ) const MaxSectors = 1 << 48 +const RLEMax = 100e3 type StorageMinerActor struct{} @@ -576,6 +577,17 @@ func (sma StorageMinerActor) SubmitFallbackPoSt(act *types.Actor, vmctx types.VM return nil, aerrors.HandleExternalError(lerr, "could not load proving set node") } + { + c, nerr := self.FaultSet.Count() + if nerr != nil { + return nil, aerrors.Absorb(nerr, 6, "invalid bitfield") + } + + if c > RLEMax { + return nil, aerrors.Newf(7, "too many items in bitfield: %d", c) + } + } + faults, nerr := self.FaultSet.AllMap() if nerr != nil { return nil, aerrors.Absorb(err, 5, "RLE+ invalid") @@ -1147,6 +1159,16 @@ func onSuccessfulPoStV1(self *StorageMinerActorState, vmctx types.VMContext) aer return aerrors.HandleExternalError(nerr, "failed to load proving set") } + { + c, nerr := self.FaultSet.Count() + if nerr != nil { + return aerrors.Absorb(nerr, 2, "invalid bitfield") + } + if c > RLEMax { + return aerrors.Newf(3, "too many items in bitfield: %d", c) + } + } + faults, nerr := self.FaultSet.All() if nerr != nil { return aerrors.Absorb(nerr, 1, "invalid bitfield (fatal?)") From f32bacb32d723fa29e7465aa20da23dcdd153a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 8 Jan 2020 18:42:19 +0100 Subject: [PATCH 2/2] v0.1.6 --- build/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/version.go b/build/version.go index 99590904e..b1fd8b63d 100644 --- a/build/version.go +++ b/build/version.go @@ -5,7 +5,7 @@ import "fmt" var CurrentCommit string // BuildVersion is the local build version, set by build system -const BuildVersion = "0.1.5" +const BuildVersion = "0.1.6" var UserVersion = BuildVersion + CurrentCommit