go/src/debug
Ian Lance Taylor a0441c7ae3 encoding/gob: use saferio.SliceCap when decoding a slice
This avoids allocating an overly large slice for corrupt input.

Change the saferio.SliceCap function to take a pointer to the element type,
so that we can handle slices of interface types. This revealed that a
couple of existing calls were actually incorrect, passing the slice type
rather than the element type.

No test case because the problem can only happen for invalid data. Let
the fuzzer find cases like this.

Fixes #55338

Change-Id: I3c1724183cc275d4981379773b0b8faa01a9cbd2
Reviewed-on: https://go-review.googlesource.com/c/go/+/433296
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-25 01:18:43 +00:00
..
buildinfo debug/buildinfo: remove redundant type conversion 2022-09-06 16:59:51 +00:00
dwarf debug/dwarf: handle malformed line table with bad program offset 2022-06-23 19:05:29 +00:00
elf debug/elf: validate shstrndx 2022-09-19 17:01:22 +00:00
gosym debug/gosym: rename nameoff to nameOff to match runtime 2022-09-07 16:39:44 +00:00
macho encoding/gob: use saferio.SliceCap when decoding a slice 2022-09-25 01:18:43 +00:00
pe encoding/gob: use saferio.SliceCap when decoding a slice 2022-09-25 01:18:43 +00:00
plan9obj debug/plan9obj: don't crash on EOF before symbol type 2022-08-23 20:32:50 +00:00