mirror of
https://github.com/isar/rusqlite.git
synced 2025-02-01 14:00:51 +08:00
Fix potential unsoundness in SqliteMallocString
This commit is contained in:
parent
5a41ab869a
commit
a100adc1f2
@ -131,7 +131,8 @@ impl SqliteMallocString {
|
|||||||
// (everything is aligned to 1)
|
// (everything is aligned to 1)
|
||||||
// - `size` is also never zero, although this function doesn't actually require
|
// - `size` is also never zero, although this function doesn't actually require
|
||||||
// it now.
|
// it now.
|
||||||
let layout = Layout::from_size_align_unchecked(s.len().saturating_add(1), 1);
|
let len = s.len().saturating_add(1).min(isize::MAX as usize);
|
||||||
|
let layout = Layout::from_size_align_unchecked(len, 1);
|
||||||
// Note: This call does not return.
|
// Note: This call does not return.
|
||||||
handle_alloc_error(layout);
|
handle_alloc_error(layout);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user