Reject out-of-range column id in StripeInformationImpl::getColumnEncoding - #24
Conversation
…ding A corrupt or truncated ORC file can declare more columns in the file type tree than there are ColumnEncoding entries in the stripe footer. getColumnEncoding and getDictionarySize indexed stripeFooter_->columns(colId) directly, so such a column id hit an out-of-range protobuf RepeatedPtrField::Get and aborted the process via an absl CHECK. Bound-check the id against columns_size() and throw a ParseError instead, matching how the sibling stream accessors reject malformed footers.
|
cc @Avogar — small ORC C++ library fix: bounds-check the column id in |
|
@groeneai why does this PR contains so many commits? I think you made something wrong or used wrong targer branch |
|
@Avogar sorry, wrong base branch. The PR was opened against Retargeted the base to |
A corrupt or truncated ORC file can declare more columns in the file type tree than there are
ColumnEncodingentries in the stripe footer.getColumnEncodingandgetDictionarySizeindexedstripeFooter_->columns(colId)directly, so such a column id hit an out-of-range protobufRepeatedPtrField::Getand aborted the process via an absl CHECK (SIGABRT).Bound-check the id against
columns_size()and throw aParseErrorinstead, matching how the sibling stream accessors (getStreamInformation) already reject malformed footers.Found via the ClickHouse AST fuzzer: a fuzzed ORC blob fed to
format('ORC', ...)reachesgetColumnEncodingthrough ClickHouse's schema inference (isDictionaryEncoded) for a STRING column and crashes the server. Repro (minimal ORC: root STRUCT with one STRING child, stripe footer with only 1 ColumnEncoding) now returns a clean parse error instead of aborting.