From 5ad33896cc41d5f206043c564a49b611cbf4158d Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Thu, 18 Jun 2020 14:19:30 -0400 Subject: [PATCH] Do not allocate pieces that are bigger than a sector --- sealing.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sealing.go b/sealing.go index b4f3899bc..09e0cf84c 100644 --- a/sealing.go +++ b/sealing.go @@ -90,6 +90,10 @@ func (m *Sealing) AllocatePiece(size abi.UnpaddedPieceSize) (sectorID abi.Sector if (padreader.PaddedSize(uint64(size))) != size { return 0, 0, xerrors.Errorf("cannot allocate unpadded piece") } + + if size > abi.UnpaddedPieceSize(m.sealer.SectorSize()) { + return 0, 0, xerrors.Errorf("piece cannot fit into a sector") + } sid, err := m.sc.Next() if err != nil {