Skip to content

DatasetReader ignores UnmarshalOptions::max_bytes_literal_length when it parses a row #160

Closed

Description

@bfrancojr

DatasetReader::Create(src, opts) reads rows under the default MaxBytesLiteralLength, not opts.max_bytes_literal_length. So a caller who lowers the limit still gets a row whose b"…" cell is past it, and a caller who raises it gets that cell refused.

Where

v2.0.0 (4e96aba), src/pxf/dataset_reader.cc:

auto parsed =
    ParseDatasetRow(row_bytes,
                    static_cast<int>(columns_.size()),
                    opts_.max_nesting_depth > 0 ? opts_.max_nesting_depth : kMaxNestingDepth);

and src/pxf/parser.cc:

StatusOr<DatasetRow> ParseDatasetRow(std::string_view row, int expected, int max_depth) {
  Parser p(row, max_depth, kMaxBytesLiteralLength);

Only the depth reaches the row parser. protowire-go applies the caller's limit to rows (encoding/pxf/dataset_stream.go at 903b4a7: lexer{..., maxBytesLiteral: tr.lim.maxBytesLiteral, ...}).

Measured

Through protowire-python's DatasetReader.from_bytes(data, max_bytes_literal_length=191) (trendvidia/protowire-python#36), which passes the limit to Create: on @dataset lim.H (b) with a row holding a 192-byte b"…" cell, next_or_none() returns the row. The same literal through pxf::Unmarshal at 191 is refused with bytes literal decodes to more than MaxBytesLiteralLength=191 bytes.

Done when: ParseDatasetRow takes the bytes limit, DatasetReader passes opts_.max_bytes_literal_length (0 → default), and a test lowers it on a row. protowire-python pins the current behaviour in an xfail test that flips when this lands.

Activity

  1. bfrancojr commented on Nov 7, 2026

    @bfrancojr
    CollaboratorAuthor

    protowire-python now builds on v2.1.0 (trendvidia/protowire-python#46, merged as a1a1d70). The strict xfail pinned for this issue (test_dataset_reader_reads_rows_under_its_limits) passes and has been removed. It still fails on a v2.0.0 build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions