Repository navigation
fix(nfttx): return the unmarshal error from OutputStream.StateAt - #2582
Open
AkramBitar wants to merge 1 commit into
Open
AkramBitar wants to merge 1 commit into
AkramBitar wants to merge 1 commit into
Conversation
AkramBitar
added a commit
that referenced
this pull request
Oct 29, 2026
`QueryByKey` checked `err == nil` where it meant `err != nil`, so a malformed state was hidden behind `ErrNoResults`. The good path worked only because `errors.Wrap(nil, ...)` returns `nil`. The decode moves into a `decodeState` helper that also rejects a type holding the JSON `null` literal, which unmarshals without writing anything. `OutputStream.StateAt` has the same inverted check; left to #2582. Fixes #2561 Signed-off-by: AkramBitar <akram@il.ibm.com>
`StateAt` checked `err == nil` where it meant `err != nil`. A bad payload was reported as success with `state` left empty, so callers acted on garbage. The good path worked only because `errors.Wrap(nil, ...)` returns `nil`. Three fixes: - flip the condition; - reject a type holding the JSON `null` literal: it unmarshals without writing anything, which is the same false success; - return an error for an out-of-range index instead of panicking. Unit tests and `FuzzStateAtNoPanic` cover all three, and the fuzz target runs in the nightly matrix. Revert any one fix and a test fails. `QueryByKey` in `qe.go` has the same inverted check. Left for #2561. Fixes #2560 Signed-off-by: AkramBitar <akram@il.ibm.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OutputStream.StateAtcheckederr == nilwhere it meanterr != nil. A bad payload was reported as success withstateleft empty, so callers acted on garbage. The good path worked only becauseerrors.Wrap(nil, ...)returnsnil.Three fixes:
nullliteral — it unmarshals without writing anything, which is the same false success;Unit tests and
FuzzStateAtNoPaniccover all three, and the fuzz target runs in the nightly matrix. Revert any one fix and a test fails.QueryByKeyinqe.gohas the same inverted check. Left for #2561.Fixes #2560