From 429b7dd7287adc311f64998ade6d9e906d3c6535 Mon Sep 17 00:00:00 2001 From: Daniel Morais Date: Wed, 4 Oct 2023 10:54:04 +0200 Subject: [PATCH 1/2] Make sure nb_bitmap_char is initialized --- src/bolos/fonts_info.c | 5 +++++ src/launcher.c | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/bolos/fonts_info.c b/src/bolos/fonts_info.c index b8900863..84f94757 100644 --- a/src/bolos/fonts_info.c +++ b/src/bolos/fonts_info.c @@ -197,6 +197,11 @@ void parse_fonts(void *code, unsigned long text_load_addr, nb_fonts = fonts_size / 4; } + // There is no font or we don't know its format + if (!nb_fonts) { + return; + } + // Checks that fonts & nb_fonts are coherent if (fonts[nb_fonts] != nb_fonts) { fprintf(stdout, "ERROR: Expecting nb_fonts=%u and found %u instead!\n", diff --git a/src/launcher.c b/src/launcher.c index d68c7f4e..5a328ea4 100644 --- a/src/launcher.c +++ b/src/launcher.c @@ -541,10 +541,8 @@ static int run_app(char *name, unsigned long *parameters) app = get_current_app(); // Parse fonts and build bitmap -> character table - if ((app->elf.fonts_addr != 0) || (hw_model == MODEL_STAX)) { - parse_fonts(memory.code, app->elf.text_load_addr, app->elf.fonts_addr, - app->elf.fonts_size); - } + parse_fonts(memory.code, app->elf.text_load_addr, app->elf.fonts_addr, + app->elf.fonts_size); /* thumb mode */ f = (void *)((unsigned long)p | 1); From 7586afdf7d00cc99c5046ce7ec2f1fb64258be1f Mon Sep 17 00:00:00 2001 From: Daniel Morais Date: Wed, 4 Oct 2023 11:06:24 +0200 Subject: [PATCH 2/2] Fix spelling issue --- src/bolos/cx_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bolos/cx_utils.h b/src/bolos/cx_utils.h index 05e43e05..c8e3b629 100644 --- a/src/bolos/cx_utils.h +++ b/src/bolos/cx_utils.h @@ -10,7 +10,7 @@ #ifndef NATIVE_64BITS // NO 64BITS /** 64bits types, native or by-hands, depending on target and/or compiler * support. - * This type is defined here only because sha-3 struct used it INTENALLY. + * This type is defined here only because sha-3 struct used it INTERNALLY. * It should never be directly used by other modules. */ struct uint64_s {