Skip to content

services/stellar-archivist: fix nil pointer panics in S3Storage.ListFiles#5934

Merged
tamirms merged 1 commit intostellar:mainfrom
satyamz:fix-stellar-archivist
Apr 22, 2026
Merged

services/stellar-archivist: fix nil pointer panics in S3Storage.ListFiles#5934
tamirms merged 1 commit intostellar:mainfrom
satyamz:fix-stellar-archivist

Conversation

@satyamz
Copy link
Copy Markdown
Contributor

@satyamz satyamz commented Apr 18, 2026

PR Checklist

PR Structure

  • This PR has reasonably narrow scope (if not, break it down into smaller PRs).
  • This PR avoids mixing refactoring changes with feature changes (split into two PRs
    otherwise).
  • This PR's title starts with name of package that is most changed in the PR, ex.
    services/friendbot, or all or doc if the changes are broad or impact many
    packages.

Thoroughness

  • This PR adds tests for the most critical parts of the new functionality or fixes.
  • I've updated any docs (developer docs, .md
    files, etc... affected by this change). Take a look in the docs folder for a given service,
    like this one.

Release planning

  • I've reviewed the changes in this PR and if I consider them worthwhile for being mentioned on release notes then I have updated the relevant CHANGELOG.md within the component folder structure. For example, if I changed horizon, then I updated (services/horizon/CHANGELOG.md. I add a new line item describing the change and reference to this PR. If I don't update a CHANGELOG, I acknowledge this PR's change may not be mentioned in future release notes.
  • I've decided if this PR requires a new major/minor version according to
    semver, or if it's mainly a patch change. The PR is targeted at the next
    release branch if it's not a patch change.

What

services/stellar-archivist: fix nil pointer panics in S3Storage.ListFiles

Why

The pagination goroutine in ListFiles dereferences resp.IsTruncated and c.Key without nil checks. Both are pointer fields from aws-sdk-go that can legitimately be nil — some S3-compatible backends (MinIO, GCS interop) omit IsTruncated entirely. Because the deref happens in a goroutine, a nil value panics the whole process instead of returning an error.

panic: runtime error: invalid memory address or nil pointer dereference
github.com/stellar/go-stellar-sdk/support/storage.(*S3Storage).ListFiles.func1()
    support/storage/s3.go:232

Known limitations

[TODO or N/A]

Signed-off-by: Satyam Zode <satyamz@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 18, 2026 05:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a crash in support/storage’s S3 backend by making S3Storage.ListFiles resilient to nil pointer fields returned by some S3-compatible APIs during pagination.

Changes:

  • Avoid direct dereference of *c.Key by using aws.StringValue(c.Key) when logging/sending keys.
  • Avoid direct dereference of *resp.IsTruncated by using aws.BoolValue(resp.IsTruncated) to drive pagination.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread support/storage/s3.go
Comment thread support/storage/s3.go
Copy link
Copy Markdown
Contributor

@SirTyson SirTyson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tamirms tamirms merged commit 9d52d04 into stellar:main Apr 22, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants