Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #90

Merged
merged 3 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions app/src/addr.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
********************************************************************************/

#pragma once
#include "zxerror.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -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
12 changes: 3 additions & 9 deletions app/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, "");
}
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions app/src/tx_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/tx_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion deps/tinycbor-ledger/cborvalidation.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion deps/tinycbor/src/cborvalidation.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
20 changes: 10 additions & 10 deletions tests_zemu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Binary file modified tests_zemu/snapshots/s-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/s-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/sp-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/sp-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/x-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/x-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading