packlist: fix crash on empty input

fogti
Sep 20, 2021, 6:33 PM
NAZOIBERE343KHGKHEAQ6DNQFVDWCA7TPAHUR6TCJB5BRHTQPE3QC

Dependencies

  • [2] 7WMS7RLP packlist: add support for parsing of multiple premarkers per item
  • [3] V4EAN7NN move some stuff around; more packlist stuff
  • [*] BUI22CYQ +zhed-packlist
  • [*] VLUIVUU5 initialize repository

Change contents

  • edit in crates/zhed-packlist/src/serial.rs at line 12
    [3.417]
    [3.417]
    #[error("unexpected EOF")]
    UnexpectedEof,
  • replacement in crates/zhed-packlist/src/serial.rs at line 23
    [3.609][3.609:658]()
    let mut fst = it.next().unwrap().trim();
    [3.609]
    [3.658]
    let mut fst = it.next().map(|x| x.trim()).ok_or(Error::UnexpectedEof)?;
  • edit in crates/zhed-packlist/src/serial.rs at line 165
    [3.4577]
    [2.1674]
    use proptest::prelude::*;
  • edit in crates/zhed-packlist/src/serial.rs at line 268
    [2.3840]
    [2.3840]
    fn fail1() {
    assert_eq!("".parse::<PackList>(), Err(Error::UnexpectedEof));
    }
    #[test]
  • edit in crates/zhed-packlist/src/serial.rs at line 313
    [2.5118]
    [3.6509]
    }
    proptest! {
    #[test]
    fn doesnt_crash(s in "\\PC*") {
    let _ = s.parse::<PackList>();
    }
  • edit in crates/zhed-packlist/Cargo.toml at line 8
    [2.8988]
    [dev-dependencies]
    proptest = "1.0"
  • edit in Cargo.lock at line 10
    [6.8028]
    [6.8028]
    [[package]]
    name = "bit-set"
    version = "0.5.2"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de"
    dependencies = [
    "bit-vec",
    ]
    [[package]]
    name = "bit-vec"
    version = "0.6.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
    [[package]]
    name = "bitflags"
    version = "1.3.2"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
    [[package]]
    name = "byteorder"
    version = "1.4.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
    [[package]]
    name = "cfg-if"
    version = "1.0.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
  • edit in Cargo.lock at line 53
    [6.8277]
    [6.8277]
    ]
    [[package]]
    name = "fnv"
    version = "1.0.7"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
    [[package]]
    name = "getrandom"
    version = "0.2.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
    dependencies = [
    "cfg-if",
    "libc",
    "wasi",
  • edit in Cargo.lock at line 73
    [6.8292]
    [6.8292]
    name = "lazy_static"
    version = "1.4.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
    [[package]]
    name = "libc"
    version = "0.2.102"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "a2a5ac8f984bfcf3a823267e5fde638acc3325f6496633a5da6bb6eb2171e103"
    [[package]]
  • edit in Cargo.lock at line 102
    [6.8747]
    [6.8747]
    [[package]]
    name = "ppv-lite86"
    version = "0.2.10"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
  • edit in Cargo.lock at line 116
    [6.8976]
    [6.8976]
    ]
    [[package]]
    name = "proptest"
    version = "1.0.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "1e0d9cc07f18492d879586c92b485def06bc850da3118075cd45d50e9c95b0e5"
    dependencies = [
    "bit-set",
    "bitflags",
    "byteorder",
    "lazy_static",
    "num-traits",
    "quick-error 2.0.1",
    "rand",
    "rand_chacha",
    "rand_xorshift",
    "regex-syntax",
    "rusty-fork",
    "tempfile",
  • edit in Cargo.lock at line 139
    [6.8991]
    [6.8991]
    name = "quick-error"
    version = "1.2.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
    [[package]]
    name = "quick-error"
    version = "2.0.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
    [[package]]
  • edit in Cargo.lock at line 160
    [6.9215]
    [6.9215]
    name = "rand"
    version = "0.8.4"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
    dependencies = [
    "libc",
    "rand_chacha",
    "rand_core",
    "rand_hc",
    ]
    [[package]]
    name = "rand_chacha"
    version = "0.3.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
    dependencies = [
    "ppv-lite86",
    "rand_core",
    ]
    [[package]]
    name = "rand_core"
    version = "0.6.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
    dependencies = [
    "getrandom",
    ]
    [[package]]
    name = "rand_hc"
    version = "0.3.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
    dependencies = [
    "rand_core",
    ]
    [[package]]
    name = "rand_xorshift"
    version = "0.3.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
    dependencies = [
    "rand_core",
    ]
    [[package]]
    name = "redox_syscall"
    version = "0.2.10"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
    dependencies = [
    "bitflags",
    ]
    [[package]]
    name = "regex-syntax"
    version = "0.6.25"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
    [[package]]
    name = "remove_dir_all"
    version = "0.5.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
    dependencies = [
    "winapi",
    ]
    [[package]]
    name = "rusty-fork"
    version = "0.3.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f"
    dependencies = [
    "fnv",
    "quick-error 1.2.3",
    "tempfile",
    "wait-timeout",
    ]
    [[package]]
  • edit in Cargo.lock at line 279
    [6.10115]
    [5.3383]
    ]
    [[package]]
    name = "tempfile"
    version = "3.2.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
    dependencies = [
    "cfg-if",
    "libc",
    "rand",
    "redox_syscall",
    "remove_dir_all",
    "winapi",
  • edit in Cargo.lock at line 332
    [6.10551]
    [3.12129]
    name = "wait-timeout"
    version = "0.2.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
    dependencies = [
    "libc",
    ]
    [[package]]
    name = "wasi"
    version = "0.10.2+wasi-snapshot-preview1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
    [[package]]
    name = "winapi"
    version = "0.3.9"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
    dependencies = [
    "winapi-i686-pc-windows-gnu",
    "winapi-x86_64-pc-windows-gnu",
    ]
    [[package]]
    name = "winapi-i686-pc-windows-gnu"
    version = "0.4.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
    [[package]]
    name = "winapi-x86_64-pc-windows-gnu"
    version = "0.4.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
    [[package]]
  • edit in Cargo.lock at line 386
    [6.10690]
    [3.12247]
    "proptest",