fix(es): use PLATFORM bound for pool bucket array size check - #2829
Open
philphauler wants to merge 1 commit into
Open
philphauler wants to merge 1 commit into
philphauler wants to merge 1 commit into
Conversation
The NumBlockSizes validation in CFE_ES_PoolCreateEx_WithAlignment uses CFE_MISSION_ES_POOL_MAX_BUCKETS, but the actual Buckets array in CFE_ES_GenPoolRecord_t is sized to CFE_PLATFORM_ES_POOL_MAX_BUCKETS. When MISSION > PLATFORM (a valid, documented configuration), this allows NumBlockSizes values that overflow the array in GenPoolInitialize, corrupting adjacent entries in the global pool table.
philphauler
force-pushed
the
fix-pool-bounds-check
branch
from
September 5, 2026 20:55
e9031dc to
b3c8f82
Compare
Contributor
Author
czogby-nasa
previously approved these changes
Sep 10, 2026
dzbaker
self-requested a review
September 10, 2026 14:52
dzbaker
dismissed
czogby-nasa’s stale review
September 10, 2026 14:53
Going to assign review to cFS Core dev team.
Contributor
Author
|
Nice! Sorry for taking the time, I'll also sign the CLA thingy asap, and run some more online courses to become actually more useful 🙏🙌 |
Contributor
Author
|
Quick update: my Individual CLA for the cFS framework went to GSFC-SoftwareRelease on 2026-09-16, after this PR was opened, so I've ticked that box in the checklist. Happy to adjust anything if needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist (Please check before submitting)
Describe the contribution
Fixes #2828. In
CFE_ES_PoolCreateEx_WithAlignment(),NumBlockSizesis checked againstCFE_MISSION_ES_POOL_MAX_BUCKETS, but theBuckets[]array is sized toCFE_PLATFORM_ES_POOL_MAX_BUCKETS. WhenMISSION > PLATFORM(valid percfe_missionlib_verify.h), the bounds check passes but subsequent writes exceed the array, causing OOB writes.One-line fix: replace
CFE_MISSION_ES_POOL_MAX_BUCKETSwithCFE_PLATFORM_ES_POOL_MAX_BUCKETSincfe_es_mempool.cso the check matches the actual array size.Testing performed
The bucket-count check in
cfe_es_mempool.cnow uses the PLATFORM bound the array is allocated with, and the syslog prints that same bound. Run locally in the cFS dev bundle: coverage-es passes. With sample_defs (MISSION == PLATFORM == 17) behavior is unchanged; the check only differs when a mission raises the MISSION bound above the PLATFORM allocation.Expected behavior changes
Configurations where
CFE_MISSION_ES_POOL_MAX_BUCKETS > CFE_PLATFORM_ES_POOL_MAX_BUCKETSnow correctly reject excess bucket counts instead of writing out of bounds.System(s) tested on
Hardware: x86_64 (WSL2), OS: Ubuntu 22.04, Versions: cFE dev 2612eb0 with OSAL and PSP from the cFS dev bundle, native build with ENABLE_UNIT_TESTS
Contributor Info
Filip Koscak - phil.phaulre@gmail.com