1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-17 13:38:46 +00:00

fix(core): panic in Map::try_clone

[no changelog]
This commit is contained in:
Martin Milata 2025-05-27 15:00:28 +02:00
parent 9285b73e47
commit b5fc3a8361

View File

@ -164,9 +164,11 @@ impl Map {
impl Map {
pub fn try_clone(&self) -> Result<Self, Error> {
let mut map = Self::with_capacity(self.len())?;
if !self.table.is_null() {
unsafe {
ptr::copy_nonoverlapping(self.table, map.table, self.len());
}
}
map.set_used(self.used());
map.set_all_keys_are_qstrs(self.all_keys_are_qstrs());
map.set_is_ordered(self.is_ordered());