Skip to content

Reject array list capacity overflows#578

Open
Old-Ding wants to merge 1 commit into
ros2:rollingfrom
Old-Ding:codex/fix-array-list-capacity-overflow
Open

Reject array list capacity overflows#578
Old-Ding wants to merge 1 commit into
ros2:rollingfrom
Old-Ding:codex/fix-array-list-capacity-overflow

Conversation

@Old-Ding

Copy link
Copy Markdown

Summary

  • reject initial capacity and element-size combinations whose allocation size would overflow
  • reject capacity doubling or resized allocation sizes that would wrap during growth
  • avoid addition overflow when deciding whether a full list needs to grow

Testing

  • linked a focused probe against origin/rolling: SIZE_MAX * SIZE_MAX initialization returned success with initialized=1
  • linked the same probe against this change: returned RCUTILS_RET_BAD_ALLOC with initialized=0
  • linked a normal growth probe: appended and retrieved 17 values with result=0 size=17
  • compiled src/array_list.c as C11 with Zig using -Wall -Wextra -Werror
  • git diff --check

Reject capacity arithmetic that would wrap allocation sizes or
growth, while preserving normal array list expansion behavior.

Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
@mergify

mergify Bot commented Jul 11, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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.

1 participant