diff --git a/app/Makefile.version b/app/Makefile.version index 1bf568e3..071dc345 100644 --- a/app/Makefile.version +++ b/app/Makefile.version @@ -3,4 +3,4 @@ APPVERSION_M=2 # This is the `spec_version` field of `Runtime` APPVERSION_N=35 # This is the patch version of this release -APPVERSION_P=6 +APPVERSION_P=7 diff --git a/app/src/addr.h b/app/src/addr.h index cac4c26b..d9bbae1d 100644 --- a/app/src/addr.h +++ b/app/src/addr.h @@ -15,6 +15,7 @@ ********************************************************************************/ #pragma once +#include "zxerror.h" #ifdef __cplusplus extern "C" { @@ -29,8 +30,6 @@ zxerr_t addr_getItem(int8_t displayIdx, char *outValue, uint16_t outValueLen, uint8_t pageIdx, uint8_t *pageCount); -zxerr_t addr_to_textual(char *s, uint16_t max, const char *text, uint16_t textLen); - #ifdef __cplusplus } #endif diff --git a/app/src/parser.c b/app/src/parser.c index aa530504..0292e760 100644 --- a/app/src/parser.c +++ b/app/src/parser.c @@ -316,11 +316,8 @@ __Z_INLINE parser_error_t parser_screenPrint(const parser_context_t *ctx, // No Tittle screen if (container->screen.titleLen == 0) { MEMCPY(tmp, container->screen.contentPtr, container->screen.contentLen); - parser_error_t err = tx_display_translation(out, sizeof(out),tmp, container->screen.contentLen); - if (err != parser_ok) { - return err; - } - + CHECK_PARSER_ERR(tx_display_translation(out, sizeof(out),tmp, container->screen.contentLen)) + for (uint8_t i = 0; i < container->screen.indent; i++) { z_str3join(out, sizeof(out), SCREEN_INDENT, ""); } @@ -333,10 +330,7 @@ __Z_INLINE parser_error_t parser_screenPrint(const parser_context_t *ctx, //Translate output, cpy to tmp to assure it ends in \0 MEMZERO(tmp, tmp_len); MEMCPY(tmp, container->screen.contentPtr, container->screen.contentLen); - parser_error_t err = tx_display_translation(out, sizeof(out), tmp,container->screen.contentLen); - if (err != parser_ok) { - return err; - } + CHECK_PARSER_ERR(tx_display_translation(out, sizeof(out), tmp,container->screen.contentLen)) uint8_t titleLen = container->screen.titleLen + container->screen.indent; //Title needs to be truncated, so we concat title witn content diff --git a/app/src/tx_display.c b/app/src/tx_display.c index 08944f4a..faa3412d 100644 --- a/app/src/tx_display.c +++ b/app/src/tx_display.c @@ -529,7 +529,6 @@ parser_error_t tx_display_translation(char *dst, uint16_t dstLen, char *src, uin MEMZERO(dst, dstLen); char *p = src; uint16_t count = 0; - uint8_t verified_bytes = 0; while (*p) { utf8_int32_t tmp_codepoint = 0; @@ -564,7 +563,7 @@ parser_error_t tx_display_translation(char *dst, uint16_t dstLen, char *src, uin swapped = (swapped >> 16) & 0xFFFF; } - if (dstLen < bytes_to_print) { + if (dstLen < (bytes_to_print + count)) { return parser_unexpected_value; } @@ -575,17 +574,18 @@ parser_error_t tx_display_translation(char *dst, uint16_t dstLen, char *src, uin *dst++ = (buf[i] >= 'a' && buf[i] <= 'z') ? (buf[i] - 32) : buf[i]; } } - verified_bytes ++; } if (src[srcLen - 1] == ' ' || src[srcLen - 1] == '@') { if (src[dstLen - 1] + 1 > dstLen) { return parser_unexpected_value; } + ASSERT_PTR_BOUNDS(count, dstLen); *dst++ = '@'; } // Terminate string + ASSERT_PTR_BOUNDS(count, dstLen); *dst = 0; return parser_ok; } diff --git a/app/src/tx_parser.c b/app/src/tx_parser.c index 11c99e13..415eabba 100644 --- a/app/src/tx_parser.c +++ b/app/src/tx_parser.c @@ -145,7 +145,7 @@ parser_error_t tx_traverse_find(uint16_t root_token_index, uint16_t *ret_value_t CHECK_APP_CANARY() - if (parser_tx_obj.tx_json.tx == NULL || root_token_index < 0) { + if (parser_tx_obj.tx_json.tx == NULL) { return parser_no_data; } diff --git a/deps/ledger-zxlib b/deps/ledger-zxlib index 4d653c64..0b4cca5a 160000 --- a/deps/ledger-zxlib +++ b/deps/ledger-zxlib @@ -1 +1 @@ -Subproject commit 4d653c64f0f773381c9f4784756c909ec14d0095 +Subproject commit 0b4cca5a72b4213b0586003e531fb79eb231d767 diff --git a/deps/tinycbor-ledger/cborvalidation.c b/deps/tinycbor-ledger/cborvalidation.c index f76d25c6..ae02864f 100644 --- a/deps/tinycbor-ledger/cborvalidation.c +++ b/deps/tinycbor-ledger/cborvalidation.c @@ -377,7 +377,7 @@ static inline CborError validate_floating_point(CborValue *it, CborType type, ui CborError err; int r; double val; - float valf; + float valf = 0.0f; uint16_t valf16 = 0x7c01; /* dummy value, an infinity */ if (type != CborDoubleType) { diff --git a/deps/tinycbor/src/cborvalidation.c b/deps/tinycbor/src/cborvalidation.c index f76d25c6..ae02864f 100644 --- a/deps/tinycbor/src/cborvalidation.c +++ b/deps/tinycbor/src/cborvalidation.c @@ -377,7 +377,7 @@ static inline CborError validate_floating_point(CborValue *it, CborType type, ui CborError err; int r; double val; - float valf; + float valf = 0.0f; uint16_t valf16 = 0x7c01; /* dummy value, an infinity */ if (type != CborDoubleType) { diff --git a/tests_zemu/package.json b/tests_zemu/package.json index d85452e7..e4ea2965 100644 --- a/tests_zemu/package.json +++ b/tests_zemu/package.json @@ -18,28 +18,28 @@ }, "dependencies": { "@zondax/ledger-cosmos-js": "^3.0.2", - "@zondax/zemu": "^0.41.2" + "@zondax/zemu": "^0.42.0" }, "devDependencies": { "@types/jest": "^29.2.3", "@types/ledgerhq__hw-transport": "^4.21.4", - "@typescript-eslint/eslint-plugin": "^5.11.0", - "@typescript-eslint/parser": "^5.11.0", + "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/parser": "^5.59.6", "blakejs": "^1.1.1", "crypto-js": "4.1.1", - "eslint": "^8.9.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-import": "^2.25.4", + "eslint": "^8.40.0", + "eslint-config-prettier": "^8.8.0", + "eslint-plugin-import": "^2.27.5", "eslint-plugin-jest": "^27.1.5", "eslint-plugin-prettier": "^4.0.0", - "jest": "29.3.1", + "jest": "29.5.0", "jest-serial-runner": "^1.1.0", + "js-sha3": "0.8.0", "jssha": "^3.2.0", - "prettier": "^2.5.1", + "prettier": "^2.8.8", "secp256k1": "^4.0.3", - "js-sha3": "0.8.0", "ts-jest": "^29.0.3", "ts-node": "^10.9.1", - "typescript": "^4.5.5" + "typescript": "^5.0.4" } } diff --git a/tests_zemu/snapshots/s-mainmenu/00004.png b/tests_zemu/snapshots/s-mainmenu/00004.png index e855b12b..afd4112a 100644 Binary files a/tests_zemu/snapshots/s-mainmenu/00004.png and b/tests_zemu/snapshots/s-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/s-mainmenu/00010.png b/tests_zemu/snapshots/s-mainmenu/00010.png index e855b12b..afd4112a 100644 Binary files a/tests_zemu/snapshots/s-mainmenu/00010.png and b/tests_zemu/snapshots/s-mainmenu/00010.png differ diff --git a/tests_zemu/snapshots/sp-mainmenu/00004.png b/tests_zemu/snapshots/sp-mainmenu/00004.png index 00d80f05..377ccd3b 100644 Binary files a/tests_zemu/snapshots/sp-mainmenu/00004.png and b/tests_zemu/snapshots/sp-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/sp-mainmenu/00010.png b/tests_zemu/snapshots/sp-mainmenu/00010.png index 00d80f05..377ccd3b 100644 Binary files a/tests_zemu/snapshots/sp-mainmenu/00010.png and b/tests_zemu/snapshots/sp-mainmenu/00010.png differ diff --git a/tests_zemu/snapshots/x-mainmenu/00004.png b/tests_zemu/snapshots/x-mainmenu/00004.png index 00d80f05..377ccd3b 100644 Binary files a/tests_zemu/snapshots/x-mainmenu/00004.png and b/tests_zemu/snapshots/x-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/x-mainmenu/00010.png b/tests_zemu/snapshots/x-mainmenu/00010.png index 00d80f05..377ccd3b 100644 Binary files a/tests_zemu/snapshots/x-mainmenu/00010.png and b/tests_zemu/snapshots/x-mainmenu/00010.png differ