Do not allocate pieces that are bigger than a sector

This commit is contained in:
Aayush Rajasekaran 2020-06-18 14:19:30 -04:00
parent 379a4655b0
commit 5ad33896cc

View File

@ -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 {