aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fuzzer.rs
diff options
context:
space:
mode:
authorEdward Barnard2017-05-05 09:18:28 +0100
committerEdward Barnard2017-05-05 09:18:28 +0100
commitb1455ff265b563a3604f53f4c280fb485943c2c8 (patch)
tree4cccb35d523e8b5609c9e8049a88f3a238d7b264 /tests/fuzzer.rs
parentd173282f1f76bd2139891b25718725e6e87635bf (diff)
downloadrust-plist-0.2.2.tar.bz2
Use the number of bytes read from the file for binary plist excessive allocation checking.v0.2.2
Closes #22.
Diffstat (limited to 'tests/fuzzer.rs')
-rw-r--r--tests/fuzzer.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/fuzzer.rs b/tests/fuzzer.rs
index 827b8c5..f5cd4c2 100644
--- a/tests/fuzzer.rs
+++ b/tests/fuzzer.rs
@@ -29,11 +29,17 @@ fn binary_circular_reference() {
// Issue 20 - not found by fuzzing but this is a convenient place to put the test.
#[test]
-fn binary_with_data_in_trailer() {
+fn issue_20_binary_with_data_in_trailer() {
let data = b"bplist00\xd0\x08\0\0\0\0\0\0\x01\x01\0\0\0\0\0\0\0\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\t";
test_fuzzer_data_ok(data);
}
+#[test]
+fn issue_22_binary_with_byte_ref_size() {
+ let data = b"bplist00\xd1\x01\x02TTestQ1\x08\x0b\x10\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12";
+ test_fuzzer_data_ok(data);
+}
+
fn test_fuzzer_data(data: &[u8]) -> Result<Plist> {
let cursor = Cursor::new(data);
Plist::read(cursor)