fix(device-table): reject oversized entry counts - #45
Open
AbdulRehman77777 wants to merge 1 commit into
Open
Conversation
Signed-off-by: abdulrehman <ranaabdul7711@gmail.com>
AbdulRehman77777
requested review from
hshanmug12,
maheshmunnangi and
srpatcha
as code owners
August 26, 2026 12:28
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.
Summary
Reject device tables whose declared memory-region or peripheral counts exceed their fixed array capacities.
Problem
eos_device_table_validate()previously checked the table magic, version, and CRC, but did not validatemem_region_countorperiph_count.A malformed device table could therefore have a valid CRC while declaring more entries than its fixed arrays can store.
Code that trusts a successful validation result could then iterate past the bounds of the memory-region or peripheral arrays.
Solution
Add structural validation for both count fields before accepting the table:
mem_region_count > EOS_MAX_MEM_REGIONSperiph_count > EOS_MAX_PERIPHERALSEOS_ERR_INVALIDerror for invalid structural metadataValid device tables and the public API remain unchanged.
Testing
test_device_table: 8/8 passed after the fix.test_recoverylink failure on upstream.git diff --checkpassed.Impact / Limitations
This is a focused device-table validation fix with no API changes or new dependencies.
The existing unrelated
test_recoverylink failure and pre-existing compiler warnings are not addressed by this PR.