]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: avoid clearing memory during byte slice allocation in gobytes
authorMartin Möhrmann <moehrmann@google.com>
Sun, 18 Feb 2018 13:12:52 +0000 (14:12 +0100)
committerMartin Möhrmann <moehrmann@google.com>
Mon, 19 Feb 2018 05:58:51 +0000 (05:58 +0000)
commitdfb0e4f6c744eb9bf629658bf7da313b2d1518e1
treecf1d10cda3558d42ba307010dcca595710cbc378
parenta4e950ec9ed4b862245451a5d167138c73d8c2e9
runtime: avoid clearing memory during byte slice allocation in gobytes

Avoid using make in gobytes which clears the byte slice backing
array unnecessarily since the content is overwritten immediately again.

Check that the user provided length is positive and below the maximum
allowed allocation size explicitly in gobytes as this was done in makeslice
before this change.

Fixes #23634

Change-Id: Id852619e932aabfc468871c42ad07d34da91f45c
Reviewed-on: https://go-review.googlesource.com/94760
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/string.go