Skip to content

Commit

Permalink
Merge pull request #1486 from 0chain/hotfix/reader-seek
Browse files Browse the repository at this point in the history
fix content seek in wasm
  • Loading branch information
dabasov authored May 8, 2024
2 parents ad88be2 + 5d5bfbb commit cf7da11
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wasmsdk/jsbridge/file_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ func (r *FileReader) Seek(offset int64, whence int) (int64, error) {
if abs < 0 {
return 0, errors.New("FileReader.Seek: negative position")
}
r.offset = abs
if abs > int64(len(r.buf)) {
return 0, errors.New("FileReader.Seek: position out of bounds")
}
r.bufOffset = int(abs)
return abs, nil
}

0 comments on commit cf7da11

Please sign in to comment.