Skip to content

When capacity of padded_string_view is given a size smaller than length, padding() is wrapping #2120

@longod

Description

@longod

When capacity of padded_string_view is given a size smaller than length, padding() is wrapping.
Therefore, parser::iterate_raw does not return INSUFFICIENT_PADDING error.

simdjson::ondemand::parser parser;
size_t bad_capacity = 0;
auto doc = parser.iterate("{\"a\": 0 }", bad_capacity);
auto error = doc.error(); // SUCCESS

It seems addition is better.

  if (json.capacity() < json.length() + SIMDJSON_PADDING) { return INSUFFICIENT_PADDING; }

Configuration

  • OS: Windows 10 64-bit
  • Compiler: MSVC 17.8.6
  • Version: 3.6.4
  • Optimization setting: /Od

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions