mirror of
https://github.com/garraflavatra/go-fmp.git
synced 2025-06-27 20:15:11 +00:00
Return error for sector headers
This commit is contained in:
@ -11,6 +11,7 @@ var (
|
||||
ErrBadHeader = FmpError("bad header")
|
||||
ErrUnsupportedCharset = FmpError("unsupported character set")
|
||||
ErrBadSectorCount = FmpError("bad sector count")
|
||||
ErrBadSectorHeader = FmpError("bad sector header")
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -147,6 +147,10 @@ func (ctx *FmpFile) readSector() (*FmpSector, error) {
|
||||
NextID: parseVarUint64(buf[8 : 8+4]),
|
||||
}
|
||||
|
||||
if ctx.currentSectorID == 0 && sector.PrevID > 0 {
|
||||
return nil, ErrBadSectorHeader
|
||||
}
|
||||
|
||||
payload := make([]byte, sectorPayloadSize)
|
||||
n, err = ctx.stream.Read(payload)
|
||||
|
||||
|
Reference in New Issue
Block a user