check bounds in readPICFrame

Fixes #77
This commit is contained in:
David Howden 2020-11-20 06:25:35 +11:00
parent 53ee65d2ae
commit 6b18201aa5

View File

@ -564,6 +564,10 @@ func (p Picture) String() string {
// Description <textstring> $00 (00)
// Picture data <binary data>
func readPICFrame(b []byte) (*Picture, error) {
if len(b) < 5 {
return nil, errors.New("invalid PIC frame")
}
enc := b[0]
ext := string(b[1:4])
picType := b[4]