You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Ismaël Mejía (Jira)" <ji...@apache.org> on 2026/07/11 10:01:00 UTC

[jira] [Created] (AVRO-4278) [c++] Bound collection size when decoding arrays and maps in GenericReader

Ismaël Mejía created AVRO-4278:
----------------------------------

             Summary: [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.13.0
            Reporter: Ismaël Mejía


{{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)