From 6ebdd16489539de4facd0ce21f2514bb898ee5c0 Mon Sep 17 00:00:00 2001 From: GroM Date: Thu, 31 Oct 2024 08:38:57 +0100 Subject: [PATCH] Update assert on heap size --- Cargo.lock | 4 ++-- ledger_device_sdk/Cargo.toml | 4 ++-- ledger_secure_sdk_sys/Cargo.toml | 2 +- ledger_secure_sdk_sys/build.rs | 9 ++++----- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77efcf5..763e0d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -474,7 +474,7 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "ledger_device_sdk" -version = "1.18.1" +version = "1.18.2" dependencies = [ "const-zero", "include_gif", @@ -489,7 +489,7 @@ dependencies = [ [[package]] name = "ledger_secure_sdk_sys" -version = "1.5.1" +version = "1.5.2" dependencies = [ "bindgen", "cc", diff --git a/ledger_device_sdk/Cargo.toml b/ledger_device_sdk/Cargo.toml index 457109e..fdd76e7 100644 --- a/ledger_device_sdk/Cargo.toml +++ b/ledger_device_sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ledger_device_sdk" -version = "1.18.1" +version = "1.18.2" authors = ["yhql", "yogh333", "agrojean-ledger", "kingofpayne"] edition = "2021" license.workspace = true @@ -21,7 +21,7 @@ rand_core = { version = "0.6.3", default_features = false } zeroize = { version = "1.6.0", default_features = false } numtoa = "0.2.4" const-zero = "0.1.1" -ledger_secure_sdk_sys = { path = "../ledger_secure_sdk_sys", version = "1.5.1" } +ledger_secure_sdk_sys = { path = "../ledger_secure_sdk_sys", version = "1.5.2" } [features] speculos = [] diff --git a/ledger_secure_sdk_sys/Cargo.toml b/ledger_secure_sdk_sys/Cargo.toml index 66bf066..5431c19 100644 --- a/ledger_secure_sdk_sys/Cargo.toml +++ b/ledger_secure_sdk_sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ledger_secure_sdk_sys" -version = "1.5.1" +version = "1.5.2" authors = ["yhql", "agrojean-ledger"] edition = "2021" license.workspace = true diff --git a/ledger_secure_sdk_sys/build.rs b/ledger_secure_sdk_sys/build.rs index 8247fb9..483bc2f 100644 --- a/ledger_secure_sdk_sys/build.rs +++ b/ledger_secure_sdk_sys/build.rs @@ -600,12 +600,11 @@ impl SDKBuilder { // Read the HEAP_SIZE environment variable, default to 8192 if not set let heap_size = env::var("HEAP_SIZE").unwrap_or_else(|_| "8192".to_string()); + let heap_size_value = heap_size.parse::().unwrap(); + assert!( - match heap_size.as_str() { - "2048" | "4096" | "8192" | "16384" | "24576" => true, - _ => false, - }, - "Invalid heap size: {heap_size}; Authorized sizes are 2048, 4096, 8192, 16384, 24576" + heap_size_value >= 2048 && heap_size_value <= 24576, + "Invalid heap size: {heap_size}; Shall be included in [2048, 24576]" ); // Generate the heap_size.rs file with the HEAP_SIZE value