]> Cypherpunks repositories - gostls13.git/commit
internal/saferio: handle potential total size overflow in SliceCap
authorZeke Lu <lvzecai@gmail.com>
Mon, 26 Sep 2022 14:53:54 +0000 (14:53 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 26 Sep 2022 20:36:02 +0000 (20:36 +0000)
commit4da2bc2eebb480f1c2a726de05f4e085e97d3b6c
treee9255cd2bba963635cc8a4e5116ba11a3c3b739a
parentbd8a5b00fcf71fb711ba8996a880b5b07f7b3634
internal/saferio: handle potential total size overflow in SliceCap

Before the change, "SliceCap((*int64)(nil), 1<<62)" returns 1<<62.
That's because "uintptr(c)*size" overflows and gives 0 which is less
than the "chunk". SliceCap should return -1 in this case.

Change-Id: I4e99224c8ac0fc72032c6be86d7318d33d083cd8
GitHub-Last-Rev: ca30bcce456d20702e3699822cd4f1c963ef1cec
GitHub-Pull-Request: golang/go#55870
Reviewed-on: https://go-review.googlesource.com/c/go/+/434335
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
src/internal/saferio/io.go
src/internal/saferio/io_test.go