mirror of
https://github.com/golang/go
synced 2024-11-02 09:28:34 +00:00
archive/zip: fix casting overflow on 32-bit arch
Fixes #29555 Change-Id: Ia3c0dd65bcf94dea3f6e04c23c1fe5d6d0b2c1e9 Reviewed-on: https://go-review.googlesource.com/c/156399 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
11847cb8e0
commit
f7248ba753
1 changed files with 2 additions and 2 deletions
|
@ -159,7 +159,7 @@ func (r *rleBuffer) Write(p []byte) (n int, err error) {
|
|||
return len(p), nil
|
||||
}
|
||||
|
||||
func min(x, y int) int {
|
||||
func min(x, y int64) int64 {
|
||||
if x < y {
|
||||
return x
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ func (r *rleBuffer) ReadAt(p []byte, off int64) (n int, err error) {
|
|||
if len(parts) > 0 {
|
||||
skipBytes := off - parts[0].off
|
||||
for _, part := range parts {
|
||||
repeat := min(int(part.n-skipBytes), len(p)-n)
|
||||
repeat := int(min(part.n-skipBytes, int64(len(p)-n)))
|
||||
memset(p[n:n+repeat], part.b)
|
||||
n += repeat
|
||||
if n == len(p) {
|
||||
|
|
Loading…
Reference in a new issue