From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- third_party/rust/plist/tests/data/binary.plist | Bin 0 -> 422 bytes .../plist/tests/data/binary_NSKeyedArchiver.plist | Bin 0 -> 488 bytes .../plist/tests/data/binary_circular_array.plist | Bin 0 -> 451 bytes .../plist/tests/data/binary_zero_offset_size.plist | Bin 0 -> 276 bytes third_party/rust/plist/tests/data/book.plist | 14 ++++ .../rust/plist/tests/data/utf16_bplist.plist | Bin 0 -> 1378 bytes third_party/rust/plist/tests/data/xml.plist | 36 +++++++++ third_party/rust/plist/tests/data/xml_error.plist | 17 ++++ third_party/rust/plist/tests/fuzzer.rs | 87 +++++++++++++++++++++ 9 files changed, 154 insertions(+) create mode 100644 third_party/rust/plist/tests/data/binary.plist create mode 100644 third_party/rust/plist/tests/data/binary_NSKeyedArchiver.plist create mode 100644 third_party/rust/plist/tests/data/binary_circular_array.plist create mode 100644 third_party/rust/plist/tests/data/binary_zero_offset_size.plist create mode 100644 third_party/rust/plist/tests/data/book.plist create mode 100644 third_party/rust/plist/tests/data/utf16_bplist.plist create mode 100644 third_party/rust/plist/tests/data/xml.plist create mode 100644 third_party/rust/plist/tests/data/xml_error.plist create mode 100644 third_party/rust/plist/tests/fuzzer.rs (limited to 'third_party/rust/plist/tests') diff --git a/third_party/rust/plist/tests/data/binary.plist b/third_party/rust/plist/tests/data/binary.plist new file mode 100644 index 0000000000..c9c1d5861f Binary files /dev/null and b/third_party/rust/plist/tests/data/binary.plist differ diff --git a/third_party/rust/plist/tests/data/binary_NSKeyedArchiver.plist b/third_party/rust/plist/tests/data/binary_NSKeyedArchiver.plist new file mode 100644 index 0000000000..3f86b812de Binary files /dev/null and b/third_party/rust/plist/tests/data/binary_NSKeyedArchiver.plist differ diff --git a/third_party/rust/plist/tests/data/binary_circular_array.plist b/third_party/rust/plist/tests/data/binary_circular_array.plist new file mode 100644 index 0000000000..57d4575e5c Binary files /dev/null and b/third_party/rust/plist/tests/data/binary_circular_array.plist differ diff --git a/third_party/rust/plist/tests/data/binary_zero_offset_size.plist b/third_party/rust/plist/tests/data/binary_zero_offset_size.plist new file mode 100644 index 0000000000..83ede66d50 Binary files /dev/null and b/third_party/rust/plist/tests/data/binary_zero_offset_size.plist differ diff --git a/third_party/rust/plist/tests/data/book.plist b/third_party/rust/plist/tests/data/book.plist new file mode 100644 index 0000000000..048ca6bb3c --- /dev/null +++ b/third_party/rust/plist/tests/data/book.plist @@ -0,0 +1,14 @@ + + + + + Title + Great Expectations + Author + Charles Dickens + Excerpt + Whether I should have made out this object so soon, if there had been no fine lady sitting at it, I cannot say. In an armchair, with an elbow resting on the table and her head leaning on that hand, sat the strangest lady I have ever seen, or shall ever see. + CopiesSold + 123456789 + + diff --git a/third_party/rust/plist/tests/data/utf16_bplist.plist b/third_party/rust/plist/tests/data/utf16_bplist.plist new file mode 100644 index 0000000000..a50477c4d0 Binary files /dev/null and b/third_party/rust/plist/tests/data/utf16_bplist.plist differ diff --git a/third_party/rust/plist/tests/data/xml.plist b/third_party/rust/plist/tests/data/xml.plist new file mode 100644 index 0000000000..a4016a245a --- /dev/null +++ b/third_party/rust/plist/tests/data/xml.plist @@ -0,0 +1,36 @@ + + + + + Author + William Shakespeare + Lines + + It is a tale told by an idiot, + Full of sound and fury, signifying nothing. + + Death + 1564 + Height + 1.6 + Data + + AAAAvgAAAA + MAAAAeAAAA + + Birthdate + 1981-05-16T11:32:06Z + Blank + + BiggestNumber + 18446744073709551615 + SmallestNumber + -9223372036854775808 + HexademicalNumber + 0xDEADBEEF + IsTrue + + IsNotFalse + + + diff --git a/third_party/rust/plist/tests/data/xml_error.plist b/third_party/rust/plist/tests/data/xml_error.plist new file mode 100644 index 0000000000..8fe6a96ae4 --- /dev/null +++ b/third_party/rust/plist/tests/data/xml_error.plist @@ -0,0 +1,17 @@ + + + + + Author + William Shakespeare + Lines + + It is a tale told by an idiot, + Full of sound and fury, signifying nothing. + + Death + 1564 + Height + 1.6 + DataAb\x90\x93\x9c\xa5\xbb\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcd"; + test_fuzzer_data_err(data); +} + +#[test] +fn binary_zero_offset_size() { + let data = include_bytes!("data/binary_zero_offset_size.plist"); + test_fuzzer_data_err(data); +} + +#[test] +fn binary_nan_date() { + let data = b"bplist00\xd6\x01\x02\x01\x04\x05\x06\x07\x0a\x0b\x0c\x0d\x0eULinesUDeathVHeightYBthridateVAuthorTData\xa2\x08\x09_\x10\x1eIt is a tale told by an idiot,_\x10+Full of sound and fury, signifying nothing.\x11\x06\x1c#?\xf9\x99\x99\x99\x99\x99\x9a3\xff\xff\xff\xffe\x00\x00\x00_\x13\x10William ShakespeareO\x10\xe5\x00\x00\x00\xbe\x00\x00\x00\x03\x00\x00\x00\x1e\x00\x00\x00\x08\x15\x1b!(14>Ab\x90\x93\x9c\xa5\xbb\xd4\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcd"; + test_fuzzer_data_err(data); +} + +#[test] +fn binary_circular_array() { + let data = include_bytes!("data/binary_circular_array.plist"); + test_fuzzer_data_err(data); +} + +// Issue 20 - not found by fuzzing but this is a convenient place to put the test. +#[test] +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); +} + +#[test] +fn overflow_instant_add() { + let data = b"bplist00\x10\x01\x00\x00\x00\x00\x00\x003~\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00"; + + test_fuzzer_data_err(data); +} + +#[test] +fn overflow_instant_sub() { + let data = b"bplist00\x10\x01\x00\x00\x00\x00\x00\x003\xfe\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00"; + + test_fuzzer_data_err(data); +} + +fn test_fuzzer_data(data: &[u8]) -> Result { + let cursor = Cursor::new(data); + Value::from_reader(cursor) +} + +fn test_fuzzer_data_ok(data: &[u8]) { + test_fuzzer_data(data).unwrap(); +} + +fn test_fuzzer_data_err(data: &[u8]) { + assert!(test_fuzzer_data(data).is_err()); +} -- cgit v1.2.3