]> Cypherpunks repositories - gostls13.git/commit
debug/elf: return FormatError when reading short files
authorMark F <fenderovlol@gmail.com>
Thu, 15 Jan 2026 12:19:10 +0000 (13:19 +0100)
committerGopher Robot <gobot@golang.org>
Thu, 22 Jan 2026 21:04:53 +0000 (13:04 -0800)
commit858d4bf8511a7741cf5c21f1d51b23ed180fd450
treebe1826d48d3d115447c6e8c9c2da3853ea7c06e8
parent8e3104dc269b959083f7e7133841e3366a477ef1
debug/elf: return FormatError when reading short files

NewFile returns the raw error from ReadAt when failing to read the
ELF identifier, typically io.EOF for empty or short files. This breaks
the API contract that all parsing failures should return *FormatError.

Wrap the error in FormatError for consistency with other error paths.

Fixes #76338

Change-Id: Ic4ed77316fcc459ce8cbe9e9506d7cf8e9286623
Reviewed-on: https://go-review.googlesource.com/c/go/+/736600
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
src/debug/elf/file.go
src/debug/elf/file_test.go