Skip to content

Commit

Permalink
Fix crashing address review after a blind signing review
Browse files Browse the repository at this point in the history
  • Loading branch information
nroggeman-ledger committed Oct 10, 2024
1 parent ddfd051 commit 4a3988e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib_nbgl/src/nbgl_use_case.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@
#define QRCODE_REDUCED_ADDR_LEN 128

// macros to ease access to shared contexts
#define keypadContext sharedContext.keypad
#define addressConfirmationContext sharedContext.addressConfirmation
#define blindSigningContext sharedContext.blindSigning
#define keypadContext sharedContext.keypad
#define blindSigningContext sharedContext.blindSigning

/**********************
* TYPEDEFS
Expand Down Expand Up @@ -119,13 +118,12 @@ typedef struct BlindSigningContext_s {
} BlindSigningContext_t;

// this union is intended to save RAM for context storage
// indeed, these three contexts cannot happen simultaneously
// indeed, these 2 contexts cannot happen simultaneously
typedef union {
#ifdef NBGL_KEYPAD
KeypadContext_t keypad;
#endif
AddressConfirmationContext_t addressConfirmation;
BlindSigningContext_t blindSigning;
BlindSigningContext_t blindSigning;
} SharedContext_t;

typedef struct {
Expand Down Expand Up @@ -216,6 +214,9 @@ static DetailsContext_t detailsContext;
// multi-purpose context shared for non-concurrent usages
static SharedContext_t sharedContext;

// context for address review
static AddressConfirmationContext_t addressConfirmationContext;

// contexts for generic navigation
static GenericContext_t genericContext;
static nbgl_content_t
Expand Down Expand Up @@ -713,7 +714,9 @@ static const nbgl_content_t *genericContextComputeNextPageParams(uint8_t

// Handle case where the content to be displayed is in the next content
// In such case start at element index 0.
if (nextElementIdx >= genericContext.currentContentElementNb) {
// If currentContentElementNb == 0, means not initialized, so skip
if ((nextElementIdx >= genericContext.currentContentElementNb)
&& (genericContext.currentContentElementNb > 0)) {
nextContentIdx += 1;
nextElementIdx = 0;
}
Expand Down

0 comments on commit 4a3988e

Please sign in to comment.