Skip to content

ORC-2165: [C++] Fix bounds check for LZO stop command trailer#2621

Open
ffacs wants to merge 1 commit into
apache:mainfrom
ffacs:ORC-2165-lzo-stop-trailer
Open

ORC-2165: [C++] Fix bounds check for LZO stop command trailer#2621
ffacs wants to merge 1 commit into
apache:mainfrom
ffacs:ORC-2165-lzo-stop-trailer

Conversation

@ffacs
Copy link
Copy Markdown
Contributor

@ffacs ffacs commented May 12, 2026

What changes were proposed in this pull request?

This PR fixes the C++ LZO decompressor stop command trailer validation. It now checks that two trailer bytes are available before reading them, and validates the trailer bytes
explicitly.

A regression test was added for truncated LZO stop command trailers.

Why are the changes needed?

Malformed LZO-compressed ORC input can end immediately after the LZO stop command, or with only one trailer byte remaining. The previous validation could read two bytes before safely
confirming that two bytes were available, causing an out-of-bounds read on truncated input.

The new check makes truncated LZO input fail cleanly with ParseError.

How was this patch tested?

Ran:

  cmake --build build --target orc-test -j 8
  build/c++/test/orc-test '--gtest_filter=TestDecompression.testLzo*'

The LZO decompression tests passed.

Also ran a minimal AddressSanitizer harness against truncated LZO stop command inputs and confirmed there was no ASan report.

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

Yes. Generated with OpenAI Codex.

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