mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio/wav: Bug fix: return an error when offset is before the start of the data
This commit is contained in:
parent
a14b4c8046
commit
2eac8dca8c
@ -50,8 +50,14 @@ func (s *Stream) Seek(offset int64, whence int) (int64, error) {
|
||||
offset += s.headerSize
|
||||
}
|
||||
n, err := s.src.Seek(offset, whence)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if n-s.headerSize < 0 {
|
||||
return 0, fmt.Errorf("wav: invalid offset")
|
||||
}
|
||||
s.remaining = s.dataSize - (n - s.headerSize)
|
||||
return n, err
|
||||
return n, nil
|
||||
}
|
||||
|
||||
// Read is implementation of io.Closer's Close.
|
||||
|
Loading…
Reference in New Issue
Block a user