go/src/encoding
Joe Tsai 6c431fab37 encoding: reject negative runes in Encoding.WithPadding
A negative rune (other than NoPadding) makes no semantic sense.
Doing so relies on integer overflow of converting a rune to a byte
and would thus be equivalent to passing the positive byte value
of byte(padding).

This may cause existing code to panic.
An alternative is treat negative runes as equivalent to NoPadding.
However, the code already panics to report erroneous padding values,
so this is in line with the existing API.

Change-Id: I02499705519581598adc0c8525d90e25278dc056
Reviewed-on: https://go-review.googlesource.com/c/go/+/505236
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-08-17 16:32:08 +00:00
..
ascii85 encoding: use strings.Builder 2022-09-06 15:46:20 +00:00
asn1 encoding/asn1: improve memory efficiency of ObjectIdentifier.String 2023-03-29 18:24:36 +00:00
base32 encoding: reject negative runes in Encoding.WithPadding 2023-08-17 16:32:08 +00:00
base64 encoding: reject negative runes in Encoding.WithPadding 2023-08-17 16:32:08 +00:00
binary encoding/binary: on invalid type return -1 from Size 2023-06-20 18:28:44 +00:00
csv encoding/csv: update doc comment of Read method 2023-05-10 13:00:20 +00:00
gob encoding/gob: skip TestLargeSlice on machines with small address space 2023-08-03 19:23:26 +00:00
hex encoding: add AppendEncode and AppendDecode 2023-08-17 16:23:42 +00:00
json encoding/json: declare hex as a const 2023-08-14 21:26:16 +00:00
pem all: use strings.Builder where appropriate 2022-09-29 22:56:00 +00:00
xml encoding/xml, image/jpeg, image/png: use the builtin min function 2023-08-07 00:23:29 +00:00
encoding.go encoding: document when marshaling methods can be added 2023-05-23 19:43:37 +00:00