Repository navigation
Fix #2828, use PLATFORM not MISSION bound in ES pool bucket check - #2838
Open
NAVEENKUMARKR777 wants to merge 1 commit into
Open
NAVEENKUMARKR777 wants to merge 1 commit into
NAVEENKUMARKR777 wants to merge 1 commit into
Conversation
CFE_ES_PoolCreateEx_WithAlignment() checked NumBlockSizes against CFE_MISSION_ES_POOL_MAX_BUCKETS, but the Buckets[] array it populates (CFE_ES_GenPoolRecord_t::Buckets) is sized with the platform constant. cfe_es_verify.h only requires MISSION >= PLATFORM, so a valid mission config with MISSION > PLATFORM passed the check and then wrote past the end of the array. Check against CFE_PLATFORM_ES_POOL_MAX_BUCKETS instead, matching the array's real size. Also tightens the existing unit test to the exact boundary and documents why PLATFORM (not MISSION) is the correct bound.
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.
Closes #2828
Summary
CFE_ES_PoolCreateEx_WithAlignment()bounds-checksNumBlockSizesagainstCFE_MISSION_ES_POOL_MAX_BUCKETS:but the array it populates a few lines later,
CFE_ES_GenPoolRecord_t::Buckets[](modules/es/fsw/src/cfe_es_generic_pool.h), is sized with the platform constant:cfe_es_verify.honly enforcesCFE_MISSION_ES_POOL_MAX_BUCKETS >= CFE_PLATFORM_ES_POOL_MAX_BUCKETS, which is a valid, supported configuration relationship (the mission constant also sizes theBlockStats[]telemetry array inCFE_ES_MemPoolStats_t, which is intentionally mission-wide for cross-platform telemetry compatibility - that usage at line ~708 of the same file is correct and untouched by this PR). So on any mission whereMISSION > PLATFORM, a caller-suppliedNumBlockSizesbetweenPLATFORM+1andMISSIONpasses this check and then writes past the end ofBuckets[].This fix changes the check to use
CFE_PLATFORM_ES_POOL_MAX_BUCKETS, matching the array it actually guards.Why the existing unit test didn't catch this
The reference/sample config (
cmake/sample_defs/example_mission_cfg.handexample_platform_cfg.h) sets both constants to17, so they're indistinguishable in the default unit-test build - the existing boundary test (PLATFORM_MAX_BUCKETS + 2) passed identically before and after this fix. I tightened it to the exact boundary (PLATFORM_MAX_BUCKETS + 1) and added a comment explaining whyPLATFORM, notMISSION, is the correct bound, so the intent is documented even though this specific config can't exercise the divergence.Testing
Built and ran the ES module's full coverage-test suite (
coverage-es-ALL-testrunner) via the standardsimple.mk/ENABLE_UNIT_TESTS=truenative build: 1347/1347 assertions pass, including the updatedTestESMempoolcase.