Skip to content

fix(fabric): treat a block with no header as a query failure - #1875

Merged
mbrandenburger merged 1 commit into
hyperledger-labs:mainfrom
SaidAltury-ibm:fix/1874-ledger-nil-header
Sep 22, 2026
Merged

mbrandenburger merged 1 commit into
hyperledger-labs:mainfrom
SaidAltury-ibm:fix/1874-ledger-nil-header

Conversation

@SaidAltury-ibm

Copy link
Copy Markdown
Contributor

GetBlockNumberByTxID dereferenced block.Header.Number with no nil check. The bytes come from a qscc GetBlockByTxID query against a remote peer, and Header is an optional protobuf message, so a block carrying no header unmarshals without error, leaves Header nil, and panics the client with a nil pointer dereference.

Use the nil-safe GetHeader() getter and report a missing header as a query failure, matching platform/fabricx/core/ledger and the nil Data and Metadata guards in Block.DataAt and Block.ProcessedTransaction.

Fixes #1874

GetBlockNumberByTxID dereferenced block.Header.Number with no nil check.
The bytes come from a qscc GetBlockByTxID query against a remote peer,
and Header is an optional protobuf message, so a block carrying no header
unmarshals without error, leaves Header nil, and panics the client with a
nil pointer dereference.

Use the nil-safe GetHeader() getter and report a missing header as a query
failure, matching platform/fabricx/core/ledger and the nil Data and
Metadata guards in Block.DataAt and Block.ProcessedTransaction.

Fixes hyperledger-labs#1874

Signed-off-by: Said Altury <Said.Altury@ibm.com>
@SaidAltury-ibm SaidAltury-ibm added this to the 26Q3 milestone Sep 22, 2026
@SaidAltury-ibm SaidAltury-ibm self-assigned this Sep 22, 2026
@SaidAltury-ibm SaidAltury-ibm added bug Something isn't working cleanup Something needs some cleanup labels Sep 22, 2026
@github-actions

Copy link
Copy Markdown

Hey @SaidAltury-ibm 👋 thanks for the PR!
I'm your friendly PR Helper Bot 🤖 and I'll be riding shotgun on this one, keeping track of your PR's status to help you get it approved and merged.

This comment updates automatically as you push changes -- think of it as your PR's live scoreboard!
Here's the latest:


PR Checks

✅ DCO Sign-off -- All commits have valid sign-offs. Nice work!


✅ GPG Signature -- All commits have verified GPG signatures. Locked and loaded!


✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing!


✅ Issue Link -- Linked to #1874 (assigned to you).


🎉 All checks passed! Your PR is ready for review. Great job!

@github-actions github-actions Bot added the status: needs review The pull request is ready for maintainer review label Sep 22, 2026

@mbrandenburger mbrandenburger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@mbrandenburger
mbrandenburger merged commit 122b0ba into hyperledger-labs:main Sep 22, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cleanup Something needs some cleanup status: needs review The pull request is ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(fabric): treat a block with no header as a query failure

2 participants