Decreasing stack consumption specifically on Nano X as there is a hard limit on OS side - decreasing the maximum output number for non-streamed review
What changed, and why it matters
This commit reduces how many Bitcoin transaction outputs the Ledger Nano X app can review at once (from 16 down to 8) in a specific non-streaming mode. The stated reason is to avoid exceeding the Nano X operating system's 8 KB stack limit, which could otherwise cause the app to crash or behave unpredictably when signing transactions with many outputs.
Treat as a hardening improvement. If a security advisory is issued, clarify whether any crash or fault was reproducible and whether other device models (Nano S/S Plus/Flex/Stax) were assessed for the same stack pressure. Consider adding runtime stack-usage checks or build-time static analysis to catch similar issues earlier.
Security signals we found
Stack-size limit exceeded on Nano X (8 KB OS limit)
Resource-exhaustion hardening for transaction signing path
Conditional constant reduction for a specific device model
Non-streamed review mode identified as high stack consumer
Evidence from the diff
The change in src/constants.h conditionally lowers MAX_EXT_OUTPUT_SIMPLIFIED_NUMBER from 16 to 8 only when TARGET_NANOX is defined. The accompanying comment explains that the Nano X OS enforces an 8 KB stack limit, and the previous value consumed too much stack during non-streamed transaction review. This is a defensive hardening patch rather than a fix for a demonstrated exploit, but stack exhaustion on a signing device can lead to denial of service or memory corruption during transaction signing.
Changed components
src/constants.hNano X build targetNon-streamed transaction output reviewMAX_EXT_OUTPUT_SIMPLIFIED_NUMBERInspect captured patch +6 / −0
diff --git a/src/constants.h b/src/constants.h
index 20232f8..bb3ea2b 100644
--- a/src/constants.h
+++ b/src/constants.h
@@ -56,8 +56,14 @@
/**
* Maximum number of external outputs handled simultaneously.
+ * On the Nano X, the stack size is limited to 8K at the OS level,
+ * so the stack consumption has to be limited as well.
*/
+#ifdef TARGET_NANOX
+#define MAX_EXT_OUTPUT_SIMPLIFIED_NUMBER 8
+#else
#define MAX_EXT_OUTPUT_SIMPLIFIED_NUMBER 16
+#endif
/**
* Maximum length (characters) of a base58check-encoded serialized extended pubkey.
Why this scored 35/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.