Skip to content

{bp-19770} fs/romfs: fix node cache overflow in directories with >256 entries - #19806

Open
jerpelea wants to merge 1 commit into
apache:releases/13.0from
jerpelea:bp-19770
Open

{bp-19770} fs/romfs: fix node cache overflow in directories with >256 entries#19806
jerpelea wants to merge 1 commit into
apache:releases/13.0from
jerpelea:bp-19770

Conversation

@jerpelea

Copy link
Copy Markdown
Contributor

Summary

romfs_cachenode() tracked the allocated size of rn_child in a uint8_t while rn_count is a uint16_t. Past 256 entries the size wraps to zero, the grow condition rn_count == num - 1 can never be true again and the array is not reallocated: entries are written beyond the allocation, corrupting the heap.

Track the allocated size in a size_t.

Impact

RELEASE

Testing

CI

romfs_cachenode() tracked the allocated size of rn_child in a uint8_t
while rn_count is a uint16_t. Past 256 entries the size wraps to zero,
the grow condition rn_count == num - 1 can never be true again and the
array is not reallocated: entries are written beyond the allocation,
corrupting the heap.

Track the allocated size in a size_t.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
@jerpelea
jerpelea requested a review from Donny9 as a code owner August 12, 2026 10:46
@github-actions github-actions Bot added Area: File System File System issues Size: XS The size of the change in this PR is very small labels Aug 12, 2026
@xiaoxiang781216

Copy link
Copy Markdown
Contributor

the change run out of flash, @jerpelea

@jerpelea

Copy link
Copy Markdown
Contributor Author

please restart CI after #19814 is merged

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

Labels

Area: File System File System issues Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants