-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add null terminators to strings (#36)
* Add null terminators to strings * Adds null terminators to the end of written strings to fix issue #16 * Adds optional null terminator validation while deserializing gated behind a new `extra-validation` feature flag. * Adds extensive testing for the fix. * Slightly changes the debug output for deserialized tables. * Add safety comments
- Loading branch information
1 parent
6b1c62e
commit ce0605d
Showing
411 changed files
with
2,421 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ rand = "0.8.4" | |
[features] | ||
default = ["std"] | ||
std = [] | ||
extra-validation = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
test/rust/test_files/deprecated/deserialize/contains_deprecated_data.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
RootRef { | ||
x: 1, | ||
z: 3, | ||
x: Ok( | ||
1, | ||
), | ||
z: Ok( | ||
3, | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
RootRef { | ||
x: 1, | ||
z: 2, | ||
x: Ok( | ||
1, | ||
), | ||
z: Ok( | ||
2, | ||
), | ||
} |
124 changes: 93 additions & 31 deletions
124
test/rust/test_files/enums/deserialize/change_uint13_Y.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,95 @@ | ||
RootRef { | ||
field_uint1: X, | ||
field_uint2: X, | ||
field_uint3: X, | ||
field_uint4: X, | ||
field_uint5: X, | ||
field_uint6: X, | ||
field_uint7: X, | ||
field_uint8: X, | ||
field_uint10: X, | ||
field_uint11: Y, | ||
field_uint12: Z, | ||
field_uint13: Y, | ||
field_uint14: X, | ||
field_uint15: Y, | ||
field_uint16: X, | ||
field_int1: X, | ||
field_int2: X, | ||
field_int3: X, | ||
field_int4: X, | ||
field_int5: X, | ||
field_int6: X, | ||
field_int7: X, | ||
field_int8: X, | ||
field_int10: X, | ||
field_int11: Y, | ||
field_int12: Z, | ||
field_int13: X, | ||
field_int14: X, | ||
field_int15: Y, | ||
field_int16: X, | ||
filler: 1, | ||
field_uint1: Ok( | ||
X, | ||
), | ||
field_uint2: Ok( | ||
X, | ||
), | ||
field_uint3: Ok( | ||
X, | ||
), | ||
field_uint4: Ok( | ||
X, | ||
), | ||
field_uint5: Ok( | ||
X, | ||
), | ||
field_uint6: Ok( | ||
X, | ||
), | ||
field_uint7: Ok( | ||
X, | ||
), | ||
field_uint8: Ok( | ||
X, | ||
), | ||
field_uint10: Ok( | ||
X, | ||
), | ||
field_uint11: Ok( | ||
Y, | ||
), | ||
field_uint12: Ok( | ||
Z, | ||
), | ||
field_uint13: Ok( | ||
Y, | ||
), | ||
field_uint14: Ok( | ||
X, | ||
), | ||
field_uint15: Ok( | ||
Y, | ||
), | ||
field_uint16: Ok( | ||
X, | ||
), | ||
field_int1: Ok( | ||
X, | ||
), | ||
field_int2: Ok( | ||
X, | ||
), | ||
field_int3: Ok( | ||
X, | ||
), | ||
field_int4: Ok( | ||
X, | ||
), | ||
field_int5: Ok( | ||
X, | ||
), | ||
field_int6: Ok( | ||
X, | ||
), | ||
field_int7: Ok( | ||
X, | ||
), | ||
field_int8: Ok( | ||
X, | ||
), | ||
field_int10: Ok( | ||
X, | ||
), | ||
field_int11: Ok( | ||
Y, | ||
), | ||
field_int12: Ok( | ||
Z, | ||
), | ||
field_int13: Ok( | ||
X, | ||
), | ||
field_int14: Ok( | ||
X, | ||
), | ||
field_int15: Ok( | ||
Y, | ||
), | ||
field_int16: Ok( | ||
X, | ||
), | ||
filler: Ok( | ||
1, | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
RootRef { | ||
v1: 1, | ||
v2: 2, | ||
v3: InnerType( | ||
InnerTypeRef { | ||
v3_inner: 3, | ||
}, | ||
), | ||
v4: 4, | ||
v1: Ok( | ||
1, | ||
), | ||
v2: Ok( | ||
2, | ||
), | ||
v3: Ok( | ||
InnerType( | ||
InnerTypeRef { | ||
v3_inner: Ok( | ||
3, | ||
), | ||
}, | ||
), | ||
), | ||
v4: Ok( | ||
4, | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
table Root { | ||
x: [string]; | ||
} |
Binary file not shown.
19 changes: 19 additions & 0 deletions
19
test/rust/test_files/string_list/deserialize/invalid_0_0.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
RootRef { | ||
x: Ok( | ||
[ | ||
Err( | ||
Error { | ||
source_location: ErrorLocation { | ||
type_: "[str]", | ||
method: "get", | ||
byte_offset: 24, | ||
}, | ||
error_kind: MissingNullTerminator, | ||
}, | ||
), | ||
Ok( | ||
"", | ||
), | ||
], | ||
), | ||
} |
Binary file not shown.
Oops, something went wrong.