mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
contracts: Prevent contracts from allocating a too large buffer (#7818)
* Prevent contracts from allocating a too large buffer * Fix possible integer overflow
This commit is contained in:
committed by
GitHub
parent
fd24f66c76
commit
031b4ddabb
@@ -110,6 +110,13 @@ pub struct Limits {
|
||||
pub code_size: u32,
|
||||
}
|
||||
|
||||
impl Limits {
|
||||
/// The maximum memory size in bytes that a contract can occupy.
|
||||
pub fn max_memory_size(&self) -> u32 {
|
||||
self.memory_pages * 64 * 1024
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes the weight for all categories of supported wasm instructions.
|
||||
///
|
||||
/// There there is one field for each wasm instruction that describes the weight to
|
||||
|
||||
Reference in New Issue
Block a user