-
Notifications
You must be signed in to change notification settings - Fork 101
Description
Example:
#![feature(new_uninit)]
use parity_scale_codec::{Decode, Encode};
#[derive(Encode, Decode)]
struct S(Box<[u8; 100 * 1024 * 1024]>);
impl Default for S {
fn default() -> Self {
Self(unsafe { Box::new_zeroed().assume_init() })
}
}
fn main() {
let s = S::default();
let encoded = s.encode();
println!("Encoded successfully");
S::decode(&mut encoded.as_slice()).unwrap();
}
Output:
Encoded successfully
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
fish: Job 1, 'cargo run --example overflow' terminated by signal SIGABRT (Abort)
Likely due to rust-lang/rust#53827
Metadata
Metadata
Assignees
Labels
No labels