This change refactors the parte parsing logic to operate on StringRefs of the part data rather than starting from an offset and splicing down. It also improves some of the error reporting around part layout. Specifically, this code now reports a distinct error if there isn't enough data in the buffer to store the part size and it reports an error if the parts overlap. Reviewed By: bob80905 Differential Revision: https://reviews.llvm.org/D139681
18 lines
487 B
YAML
18 lines
487 B
YAML
# RUN: yaml2obj %s | not obj2yaml 2>&1 | FileCheck %s
|
|
|
|
# In this test the hash part is too small to contain the hash data.
|
|
|
|
# CHECK: Error reading file: <stdin>: Reading structure out of file bounds
|
|
--- !dxcontainer
|
|
Header:
|
|
Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
|
|
Version:
|
|
Major: 1
|
|
Minor: 0
|
|
PartCount: 1
|
|
Parts:
|
|
- Name: HASH
|
|
Size: 0
|
|
...
|