Skip to content

Commit

Permalink
RUST-755 Use zeroed rather than uninitialized memory for decimal128 d…
Browse files Browse the repository at this point in the history
…eserialization (#263)
  • Loading branch information
abr-egn authored and patrickfreed committed Jul 23, 2021
1 parent 406fc80 commit a5a8427
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ fn read_f128<R: Read + ?Sized>(reader: &mut R) -> Result<Decimal128> {
#[cfg(feature = "decimal128")]
#[inline]
fn read_f128<R: Read + ?Sized>(reader: &mut R) -> Result<Decimal128> {
use std::mem;

let mut local_buf: [u8; 16] = unsafe { mem::MaybeUninit::uninit().assume_init() };
let mut local_buf = [0u8; 16];
reader.read_exact(&mut local_buf)?;
let val = unsafe { Decimal128::from_raw_bytes_le(local_buf) };
Ok(val)
Expand Down

0 comments on commit a5a8427

Please sign in to comment.