Skip to content

ORC-2196: [C++] Validate type tree when creating reader from serialized file tail - #2679

Closed
dongjoon-hyun wants to merge 1 commit into
apache:mainfrom
dongjoon-hyun:ORC-2196
Closed

ORC-2196: [C++] Validate type tree when creating reader from serialized file tail#2679
dongjoon-hyun wants to merge 1 commit into
apache:mainfrom
dongjoon-hyun:ORC-2196

Conversation

@dongjoon-hyun

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

This PR aims to validate the ORC type tree in createReader when the footer comes from a serialized file tail (ReaderOptions.setSerializedFileTail), by calling the existing checkProtoTypes in the same way as the file-read path.

Why are the changes needed?

The serialized-file-tail branch of createReader builds contents->footer directly from the parsed proto::FileTail without validation. A malformed footer with an out-of-range or back-referencing subtype flows into convertType, causing an out-of-bounds read or unbounded recursion (stack overflow) in release builds.

The file-read path already validates via checkProtoTypes, and the Java reader validates both tail paths (OrcTail and ReaderImpl). This closes the remaining C++ parity gap.

How was this patch tested?

Pass the CIs with a newly added test case.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Fable 5

@dongjoon-hyun dongjoon-hyun added this to the 2.3.1 milestone Jul 8, 2026
dongjoon-hyun added a commit that referenced this pull request Jul 8, 2026
…ed file tail

### What changes were proposed in this pull request?

This PR aims to validate the ORC type tree in `createReader` when the footer comes from a serialized file tail (`ReaderOptions.setSerializedFileTail`), by calling the existing `checkProtoTypes` in the same way as the file-read path.

### Why are the changes needed?

The serialized-file-tail branch of `createReader` builds `contents->footer` directly from the parsed `proto::FileTail` without validation. A malformed footer with an out-of-range or back-referencing subtype flows into `convertType`, causing an out-of-bounds read or unbounded recursion (stack overflow) in release builds.

The file-read path already validates via `checkProtoTypes`, and the Java reader validates both tail paths (`OrcTail` and `ReaderImpl`). This closes the remaining C++ parity gap.

### How was this patch tested?

Pass the CIs with a newly added test case.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Fable 5

Closes #2679 from dongjoon-hyun/ORC-2196.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 11f07f6)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
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.

1 participant