[
https://issues.apache.org/jira/browse/AVRO-4278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ismaël Mejía resolved AVRO-4278.
--------------------------------
Resolution: Duplicate
Superseded by AVRO-4294. The collection block-count cap for [c++] has been
folded into that issue's fix (PR https://github.com/apache/avro/pull/3859),
which now provides a single complete protection against collection allocation
DoS: available-bytes validation, a heap-aware cap for zero-byte-element
collections, a structural cap, and bounded skip paths. Resolving this as a
duplicate/superseded; the PR here (closed) is superseded by #3859.
> [c++] Bound collection size when decoding arrays and maps in GenericReader
> --------------------------------------------------------------------------
>
> Key: AVRO-4278
> URL: https://issues.apache.org/jira/browse/AVRO-4278
> Project: Apache Avro
> Issue Type: Sub-task
> Components: c++
> Affects Versions: 1.11.5, 1.12.1
> Reporter: Ismaël Mejía
> Assignee: Ismaël Mejía
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.12.2
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> {{GenericReader::read()}} ({{lang/c++/impl/Generic.cc}}) handles the array
> and map cases by calling {{r.resize(r.size() + m)}}, where {{m}} is the block
> count returned by {{Decoder::arrayStart()}} / {{mapStart()}} /
> {{arrayNext()}} / {{mapNext()}}. {{BinaryDecoder::doDecodeItemCount()}}
> returns this count without any upper bound, so the vector is grown to the
> requested size before any element is read.
> Add validation of the block count (per block and cumulatively) against a
> configurable maximum before resizing, and reject counts that would exceed it.
> Preferably enforce the bound in the decoder's item-count path so all
> consumers benefit. Add a test covering a small input that declares an
> oversized block count.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)