be more cautious with language parsing

Relates to #76
This commit is contained in:
David Howden
2020-11-20 06:21:29 +11:00
parent 46e57f75db
commit 53ee65d2ae
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -457,6 +457,9 @@ func readTextWithDescrFrame(b []byte, hasLang bool, encoded bool) (*Comm, error)
c := &Comm{}
if hasLang {
if len(b) < 3 {
return nil, fmt.Errorf("hasLang set but not enough data for language information")
}
c.Language = string(b[:3])
b = b[3:]
}