Repository navigation
[core] Validate record counts read from serialized bytes - #9985
Merged
JingsongLi merged 1 commit intoSep 20, 2026
Merged
Conversation
JingsongLi
reviewed
Sep 20, 2026
JingsongLi
left a comment
Contributor
There was a problem hiding this comment.
Requirement fit: SUPPORTED (triage: GO)
Implementation: CLEAN
The patch consistently rejects negative serialized collection counts and caps only the initial allocation, so valid large payloads remain readable without trusting an unbounded count for eager allocation. I checked the serializer call sites, manifest compatibility fallback, and the new boundary tests. I did not find an actionable format-compatibility or correctness regression, and CI is green.
XiaoHongbo-Hope
pushed a commit
that referenced
this pull request
Oct 8, 2026
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.
Purpose
deserializeListpre-sized itsArrayListfrom a count read straight off the wire, so a corrupt count failed inside the JDK, not at the read:FF FF FF FFgivesIllegal Capacity: -1, and7F FF FF FFanOutOfMemoryErrorbefore record 0 is read.SerializationUtils.readCountrejects a negative count with anIOExceptionnaming the serializer, next to the existingcheckVersion, andpresizedCapacitybounds the initial capacity, asPrimaryKeyIndexSourceMetadoes. A count the remaining bytes cannot cover still fails on the read.The same two lines are copied throughout paimon-core, so all 20 such counts now share the helper. Five more sit in four files that #9402 and #9949 are rewriting and are left for a follow-up. Raw arrays sized this way, in
deserializedBytesandBinaryRowSerializer.deserialize, are a separate and larger hazard, not addressed here.Tests
The three list checks are in
ObjectSerializerTestBase, so its seven subclasses all run them. Reverting the two lines fails 14 of the 46, seven with each of:paimon-core: 5630 run, 0 failures.Written with Claude Code; verification is mine.