fix(emulator): fix wrong type of FIRMWARE_START
What changed, and why it matters
This commit fixes a type mismatch in the Trezor firmware emulator's bootloader code. The FIRMWARE_START symbol was declared as a pointer to bytes (uint8_t*) but was being assigned a raw memory address value. On 64-bit emulator builds this could lead to incorrect memory handling or crashes because the sizes and interpretations of the two types differ. The fix changes the symbol to a plain integer address type (uintptr_t), which is the correct way to store raw memory addresses in portable C code. This change only affects the emulator (software simulation), not real Trezor hardware.
Treat as a routine code-quality/correctness fix. No urgent security action is warranted based solely on this diff. If auditing, verify that all pointer/integer conversions for memory addresses in the emulator use uintptr_t consistently and that real hardware builds are unaffected.
Security signals we found
Type confusion between pointer and integer address types in bootloader code
Change only affects emulator build, not production hardware firmware
No changelog entry provided ([no changelog])
No CVE, advisory, or security disclosure referenced in commit
Evidence from the diff
In core/embed/projects/bootloader/emulator.c and emulator.h, FIRMWARE_START was defined as uint8_t* but used to hold the result of flash_area_get_address(), which returns a raw address. The patch redefines it as uintptr_t and casts the assignment accordingly. This resolves a pointer/integer type confusion bug. The change is confined to the emulator build and the bootloader component. There is no direct evidence in the commit of an exploitable security vulnerability; it appears to be a correctness/portability fix, though type confusion in bootloader code can theoretically have security implications.
Changed components
core/embed/projects/bootloader/emulator.ccore/embed/projects/bootloader/emulator.hTrezor firmware bootloader emulatorInspect captured patch +3 / −3
diff --git a/core/embed/projects/bootloader/emulator.c b/core/embed/projects/bootloader/emulator.c
index 29f76a56..eca99251 100644
--- a/core/embed/projects/bootloader/emulator.c
+++ b/core/embed/projects/bootloader/emulator.c
@@ -24,7 +24,7 @@ LOG_DECLARE(emulator)
#undef FIRMWARE_START
-uint8_t *FIRMWARE_START = 0;
+uintptr_t FIRMWARE_START = 0;
int bootloader_main(void);
@@ -141,7 +141,7 @@ int main(int argc, char **argv) {
flash_init();
flash_otp_init();
- FIRMWARE_START = (uint8_t *)flash_area_get_address(&FIRMWARE_AREA, 0, 0);
+ FIRMWARE_START = (uintptr_t)flash_area_get_address(&FIRMWARE_AREA, 0, 0);
// simulate non-empty storage so that we know whether it was erased or not
if (storage_empty(&STORAGE_AREAS[0])) {
diff --git a/core/embed/projects/bootloader/emulator.h b/core/embed/projects/bootloader/emulator.h
index e3d362cd..dd180302 100644
--- a/core/embed/projects/bootloader/emulator.h
+++ b/core/embed/projects/bootloader/emulator.h
@@ -23,4 +23,4 @@
#undef FIRMWARE_START
-extern uint8_t *FIRMWARE_START;
+extern uintptr_t FIRMWARE_START;
Why this scored 18/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.