Skip to content

Fix: Radix sort negative value stack buffer overflow (#871)#876

Merged
darshan2456 merged 3 commits into
darshan2456:mainfrom
Akshatshukla-25:feature/fix-radix-sort-negative-overflow-bug5
Jul 17, 2026
Merged

Fix: Radix sort negative value stack buffer overflow (#871)#876
darshan2456 merged 3 commits into
darshan2456:mainfrom
Akshatshukla-25:feature/fix-radix-sort-negative-overflow-bug5

Conversation

@Akshatshukla-25

Copy link
Copy Markdown
Contributor

Description

This PR addresses Bug 5 of issue #871. It adds a validation pass at the beginning of radix_sort inside src/advanced_sorting_algorithms/radix_sort.c to reject arrays containing negative values. This prevents counting sort from using negative indices which would cause out-of-bounds writes on the stack-allocated count array.

Resolves

Changes

  • radix_sort.c: Validates that all elements inside the input array are non-negative.
  • Makefile: Linked missing help objects to resolve test suite build errors (carried over to this branch).

Verification & Testing

  • Ran make fmt to ensure style correctness.
  • Compiled successfully with make.
  • Ran and passed all unit tests with make test.

@darshan2456
darshan2456 merged commit cee0bb3 into darshan2456:main Jul 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants