mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio/wav: Bug fix: fmt header can be more than 16 bytes
This commit is contained in:
parent
14165cc67e
commit
adde2f459e
@ -147,7 +147,8 @@ chunks:
|
||||
size := int64(buf[4]) | int64(buf[5])<<8 | int64(buf[6])<<16 | int64(buf[7])<<24
|
||||
switch {
|
||||
case bytes.Equal(buf[0:4], []byte("fmt ")):
|
||||
if size != 16 {
|
||||
// Size of 'fmt' header is usually 16, but can be more than 16.
|
||||
if size < 16 {
|
||||
return nil, fmt.Errorf("wav: invalid header: maybe non-PCM file?")
|
||||
}
|
||||
buf := make([]byte, size)
|
||||
|
Loading…
Reference in New Issue
Block a user