Skip to content

Commit

Permalink
Make sure nb_bitmap_char is initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
dmorais-ledger committed Oct 4, 2023
1 parent 73c3b0a commit 429b7dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/bolos/fonts_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 2 additions & 4 deletions src/launcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 429b7dd

Please sign in to comment.