Skip to content

rlp: finalize listIterator on parse error to prevent non-advancing loops - #33245

Merged
fjl merged 1 commit into
ethereum:masterfrom
radik878:fix/rlp-listiterator-next-error-termination
Nov 26, 2025
Merged

rlp: finalize listIterator on parse error to prevent non-advancing loops#33245
fjl merged 1 commit into
ethereum:masterfrom
radik878:fix/rlp-listiterator-next-error-termination

Conversation

@radik878

Copy link
Copy Markdown
Contributor

The list iterator previously returned true on parse errors without advancing the input, which could lead to non-advancing infinite loops for callers that do not check Err() inside the loop; to make iteration safe while preserving error visibility, Next() now marks the iterator as finished when readKind fails, returning true for the error step so existing users that check Err() can handle it, and then false on subsequent calls, and the function comment was updated to document this behavior and the need to check Err().

@radik878
radik878 requested a review from fjl as a code owner November 22, 2025 14:36
@fjl
fjl merged commit cf93077 into ethereum:master Nov 26, 2025
7 of 8 checks passed
@fjl fjl added this to the 1.16.8 milestone Nov 26, 2025
prestoalvarez pushed a commit to prestoalvarez/go-ethereum that referenced this pull request Nov 27, 2025
…ops (ethereum#33245)

The list iterator previously returned true on parse errors without
advancing the input, which could lead to non-advancing infinite loops
for callers that do not check Err() inside the loop; to make iteration
safe while preserving error visibility, Next() now marks the iterator as
finished when readKind fails, returning true for the error step so
existing users that check Err() can handle it, and then false on
subsequent calls, and the function comment was updated to document this
behavior and the need to check Err().
fjl pushed a commit to lightclient/go-ethereum that referenced this pull request Nov 28, 2025
…ops (ethereum#33245)

The list iterator previously returned true on parse errors without
advancing the input, which could lead to non-advancing infinite loops
for callers that do not check Err() inside the loop; to make iteration
safe while preserving error visibility, Next() now marks the iterator as
finished when readKind fails, returning true for the error step so
existing users that check Err() can handle it, and then false on
subsequent calls, and the function comment was updated to document this
behavior and the need to check Err().
weiihann pushed a commit to weiihann/go-ethereum that referenced this pull request Jan 14, 2026
…ops (ethereum#33245)

The list iterator previously returned true on parse errors without
advancing the input, which could lead to non-advancing infinite loops
for callers that do not check Err() inside the loop; to make iteration
safe while preserving error visibility, Next() now marks the iterator as
finished when readKind fails, returning true for the error step so
existing users that check Err() can handle it, and then false on
subsequent calls, and the function comment was updated to document this
behavior and the need to check Err().
UlysseCorbeil pushed a commit to streamingfast/go-ethereum that referenced this pull request Mar 13, 2026
…ops (ethereum#33245) (ethereum#3586)

The list iterator previously returned true on parse errors without
advancing the input, which could lead to non-advancing infinite loops
for callers that do not check Err() inside the loop; to make iteration
safe while preserving error visibility, Next() now marks the iterator as
finished when readKind fails, returning true for the error step so
existing users that check Err() can handle it, and then false on
subsequent calls, and the function comment was updated to document this
behavior and the need to check Err().

Co-authored-by: radik878 <radikpadik76@gmail.com>
gballet pushed a commit to BZO95/go-ethereum that referenced this pull request May 21, 2026
…ops (ethereum#33245)

The list iterator previously returned true on parse errors without
advancing the input, which could lead to non-advancing infinite loops
for callers that do not check Err() inside the loop; to make iteration
safe while preserving error visibility, Next() now marks the iterator as
finished when readKind fails, returning true for the error step so
existing users that check Err() can handle it, and then false on
subsequent calls, and the function comment was updated to document this
behavior and the need to check Err().
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.

2 participants