[go] embed: return io.EOF for excessively big ReadAt offset

1 view
Skip to first unread message

Wanbiao Ye (Gerrit)

unread,
Aug 11, 2026, 3:08:53 AM (yesterday) Aug 11
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Wanbiao Ye has uploaded the change for review

Commit message

embed: return io.EOF for excessively big ReadAt offset

Fixes #80822
Change-Id: I509f8a06f9721713da36d83747ee4e8e5751a1c4

Change diff

diff --git a/src/embed/embed.go b/src/embed/embed.go
index 5b99c5e..0bfd74c 100644
--- a/src/embed/embed.go
+++ b/src/embed/embed.go
@@ -376,9 +376,12 @@
}

func (f *openFile) ReadAt(b []byte, offset int64) (int, error) {
- if offset < 0 || offset > int64(len(f.f.data)) {
+ if offset < 0 {
return 0, &fs.PathError{Op: "read", Path: f.f.name, Err: fs.ErrInvalid}
}
+ if offset >= int64(len(f.f.data)) {
+ return 0, io.EOF
+ }
n := copy(b, f.f.data[offset:])
if n < len(b) {
return n, io.EOF

Change information

Files:
  • M src/embed/embed.go
Change size: XS
Delta: 1 file changed, 4 insertions(+), 1 deletion(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I509f8a06f9721713da36d83747ee4e8e5751a1c4
Gerrit-Change-Number: 813000
Gerrit-PatchSet: 1
Gerrit-Owner: Wanbiao Ye <lacew...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Jorropo (Gerrit)

unread,
Aug 11, 2026, 10:58:50 AM (17 hours ago) Aug 11
to Wanbiao Ye, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Wanbiao Ye

Jorropo voted and added 1 comment

Votes added by Jorropo

Code-Review+2
Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Jorropo . unresolved

Thanks; please add a test.

Open in Gerrit

Related details

Attention is currently required from:
  • Wanbiao Ye
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I509f8a06f9721713da36d83747ee4e8e5751a1c4
Gerrit-Change-Number: 813000
Gerrit-PatchSet: 1
Gerrit-Owner: Wanbiao Ye <lacew...@gmail.com>
Gerrit-Reviewer: Jorropo <jorro...@gmail.com>
Gerrit-Attention: Wanbiao Ye <lacew...@gmail.com>
Gerrit-Comment-Date: Tue, 11 Aug 2026 14:58:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Jorropo (Gerrit)

unread,
Aug 11, 2026, 11:03:50 AM (16 hours ago) Aug 11
to Wanbiao Ye, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Wanbiao Ye

Jorropo added 1 comment

Patchset-level comments
Jorropo . unresolved

Also the same bug exists in `src/testing/fstest/mapfs.go` and should also be fixed.

Open in Gerrit

Related details

Attention is currently required from:
  • Wanbiao Ye
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I509f8a06f9721713da36d83747ee4e8e5751a1c4
Gerrit-Change-Number: 813000
Gerrit-PatchSet: 1
Gerrit-Owner: Wanbiao Ye <lacew...@gmail.com>
Gerrit-Reviewer: Jorropo <jorro...@gmail.com>
Gerrit-Attention: Wanbiao Ye <lacew...@gmail.com>
Gerrit-Comment-Date: Tue, 11 Aug 2026 15:03:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Robert Griesemer (Gerrit)

unread,
Aug 11, 2026, 2:14:25 PM (13 hours ago) Aug 11
to Wanbiao Ye, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Jorropo, golang-co...@googlegroups.com
Attention needed from Wanbiao Ye

Robert Griesemer added 1 comment

Patchset-level comments
Robert Griesemer . unresolved

Please add a test case.

Open in Gerrit

Related details

Attention is currently required from:
  • Wanbiao Ye
Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I509f8a06f9721713da36d83747ee4e8e5751a1c4
    Gerrit-Change-Number: 813000
    Gerrit-PatchSet: 1
    Gerrit-Owner: Wanbiao Ye <lacew...@gmail.com>
    Gerrit-Reviewer: Jorropo <jorro...@gmail.com>
    Gerrit-CC: Robert Griesemer <g...@google.com>
    Gerrit-Attention: Wanbiao Ye <lacew...@gmail.com>
    Gerrit-Comment-Date: Tue, 11 Aug 2026 18:14:21 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Wanbiao Ye (Gerrit)

    unread,
    Aug 11, 2026, 10:40:34 PM (5 hours ago) Aug 11
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Jorropo and Wanbiao Ye

    Wanbiao Ye uploaded new patchset

    Wanbiao Ye uploaded patch set #2 to this change.
    Following approvals got outdated and were removed:
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Jorropo
    • Wanbiao Ye
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I509f8a06f9721713da36d83747ee4e8e5751a1c4
    Gerrit-Change-Number: 813000
    Gerrit-PatchSet: 2
    Gerrit-Owner: Wanbiao Ye <lacew...@gmail.com>
    Gerrit-Reviewer: Jorropo <jorro...@gmail.com>
    Gerrit-CC: Robert Griesemer <g...@google.com>
    Gerrit-Attention: Jorropo <jorro...@gmail.com>
    Gerrit-Attention: Wanbiao Ye <lacew...@gmail.com>
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages