pijul nest
guest [sign in]

cryptovec: use NonNull::dangling instead of potentially dangled member pointer

[?]
Jan 12, 2021, 10:09 AM
CSYBOTTDUSW4DBIDMDVBQJFVFD3BA73MJNB5MRICBDGC23W6P7GAC

Dependencies

  • [2] 7FRJYUI6 Reboot because of a bad change

Change contents

  • edit in cryptovec/src/lib.rs at line 29
    [2.428990][2.428990:429004]()
    zero: u8,
  • replacement in cryptovec/src/lib.rs at line 137
    [2.431586][2.431586:431657]()
    let mut buf = CryptoVec {
    p: std::ptr::null_mut(),
    [2.431586]
    [2.431657]
    CryptoVec {
    p: std::ptr::NonNull::dangling().as_ptr(),
  • replacement in cryptovec/src/lib.rs at line 141
    [2.431703][2.431703:431846]()
    zero: 0,
    };
    // This avoids potential problems in as_slice().
    buf.p = &mut buf.zero;
    //
    buf
    [2.431703]
    [2.431846]
    }
  • edit in cryptovec/src/lib.rs at line 193
    [2.433177][2.433177:433202]()
    zero: 0,
  • edit in cryptovec/src/lib.rs at line 208
    [2.433686][2.433686:433711]()
    zero: 0,