Skip to content

Commit

Permalink
Merge pull request #795 from LedgerHQ/fix-address-review-after-blind-…
Browse files Browse the repository at this point in the history
…signing

Fix crashing address review after a blind signing review
  • Loading branch information
nroggeman-ledger authored Oct 10, 2024
2 parents ddfd051 + 4a3988e commit ab19595
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 ab19595

Please sign in to comment.