From 0a082b08ca19aab296c3b08ecf6f98d846fac756 Mon Sep 17 00:00:00 2001 From: Kareem Date: Thu, 12 Mar 2026 15:12:48 -0700 Subject: [PATCH] Code review feedback --- wolfcrypt/src/hash.c | 2 +- wolfcrypt/src/port/nxp/se050_port.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/hash.c b/wolfcrypt/src/hash.c index bf29731b32..61f7aacd63 100644 --- a/wolfcrypt/src/hash.c +++ b/wolfcrypt/src/hash.c @@ -1956,7 +1956,7 @@ int _wc_Hash_Grow(byte** msg, word32* used, word32* len, const byte* in, { word32 usedSz = 0; - if (!WC_SAFE_SUM_WORD32(*used, (word32)inSz, usedSz)) + if (inSz <= 0 || !WC_SAFE_SUM_WORD32(*used, (word32)inSz, usedSz)) return BAD_FUNC_ARG; if (*len < usedSz) { diff --git a/wolfcrypt/src/port/nxp/se050_port.c b/wolfcrypt/src/port/nxp/se050_port.c index 01693d1ec0..0783323c22 100644 --- a/wolfcrypt/src/port/nxp/se050_port.c +++ b/wolfcrypt/src/port/nxp/se050_port.c @@ -278,6 +278,9 @@ int se050_hash_update(SE050_HASH_Context* se050Ctx, const byte* data, word32 len if (se050Ctx->msg == NULL) { se050Ctx->msg = (byte*)XMALLOC(usedSz, se050Ctx->heap, DYNAMIC_TYPE_TMP_BUFFER); + if (se050Ctx->msg == NULL) { + return MEMORY_E; + } XMEMSET(se050Ctx->msg, 0, usedSz); } else {