* storage: fail on short super block extra read even without an error
Some backends (e.g. s3_backend) clear io.EOF after a short read, returning
n < len(p) with a nil error. Checking n only when the error is non-nil
lets truncated extra data reach proto.Unmarshal with a zero-filled tail.
* storage: apply the same short-read check to the super block header
A backend that returns n < SuperBlockSize with a nil error previously
slipped through and parsed a partially zero-filled header.
* storage: test super block extra reads
Covers a round trip through ReadSuperBlock, a truncated extra region, a
backend returning io.EOF alongside a full read, and a backend returning
a short read with a nil error.
---------
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
* storage: read the super block extra before unmarshaling it
ReadSuperBlock allocated a buffer of ExtraSize bytes but never filled it,
so any volume with a super block extra failed to load with an invalid
wire-format error.
Co-authored-by: chuanying chen <18412672+ccy00808@users.noreply.github.com>
* storage: test super block extra read error paths
---------
Co-authored-by: chuanying chen <18412672+ccy00808@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>