Skip to content

Fix wolfSSL_Malloc/wolfSSL_Realloc size_t truncation to word32 - #12378

Open
holtrop-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
holtrop-wolfssl:f-19258
Open

holtrop-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
holtrop-wolfssl:f-19258

Conversation

@holtrop-wolfssl

Copy link
Copy Markdown
Contributor

Description

Fix wolfSSL_Malloc/wolfSSL_Realloc size_t truncation to word32

Fixes F-19258, ANT-2026-N3N78HJ2.

Testing

How did you test?

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@holtrop-wolfssl holtrop-wolfssl self-assigned this Dec 3, 2026
Copilot AI balanced review requested due to automatic review settings December 3, 2026 14:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The unguarded XREALLOC call causes an undefined-symbol link failure in API tests on 64-bit builds with WOLFSSL_STATIC_MEMORY and WOLFSSL_NO_REALLOC enabled.

1 open issue
What changed in this PR

Prevents oversized static-memory requests from being truncated to 32 bits and matched to undersized buckets.

Changes:

  • Preserves full size_t values in malloc and realloc bucket comparisons.
  • Adds regression coverage for requests exceeding the 32-bit size limit.
File Description
wolfcrypt/​src/​memory.c Removes narrowing casts from allocation-size comparisons.
tests/​api.c Adds and registers an oversized-allocation regression test.

Review effort: Balanced

Comment thread tests/api.c Resolved
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

zephyr-frdm_rw612

  • FLASH: datas +16 B, log_const_area -8 B, rodata +108 B, text +13,816 B (+4.9%, 296,396 B / 67,108,864 B, total: 0% used)
  • RAM: bss +49 B, datas +16 B (+0.1%, 58,423 B / 983,040 B, total: 6% used)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants