HomePhabricator

[YAMLIO] Support non-null-terminated inputs

Authored by scott.linder on Nov 16 2020, 11:05 AM.

Description

[YAMLIO] Support non-null-terminated inputs

In some places the parser guards against dereferencing End, while in
others it relies on the presence of a trailing '\0' to elide checks.

Add the remaining guards needed to ensure the parser never attempts to
dereference End, making it safe to not require a null-terminated input
buffer.

Update the parser fuzzer harness so that it tests with buffers that are
guaranteed to be non-null-terminated, null-terminated, and 1-terminated,
additionally ensuring the result of the parse is the same in each case.

Some of the regression tests were written by inspection, and some are
cases caught by the fuzzer which required additional fixes in the
parser.

Differential Revision: https://reviews.llvm.org/D84050

Details

Committed
scott.linderNov 18 2020, 3:06 PM
Differential Revision
D84050: [YAMLIO] Support non-null-terminated inputs
Parents
rG544cb649d778: [YAMLIO] Add a generic YAML fuzzer harness
Branches
Unknown
Tags
Unknown