Harden PyramidSort input bounds - #83
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7035f13b64
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Закрываю как superseded by #116: изменения перенесены в одну проверенную ветку, все review findings учтены; локальный mvn verify прошёл полностью. |



Motivation
NegativeArraySizeExceptionorOutOfMemoryErrorwhen allocatingParticipant[]or growing token buffers.Description
MAX_PARTICIPANTSandMAX_LOGIN_BYTESconstants and enforce them before any large allocation.FastIn.nextInt()by rejecting sign-without-digit, non-digit characters, and integer overflow with explicitNumberFormatException.FastIn.next()by throwing anIOExceptionwhenMAX_LOGIN_BYTESis exceeded.run()(if (n < 0 || n > MAX_PARTICIPANTS)) before callingnew Participant[n].src/test/java/algorithms/sprint5/PyramidSortTest.javawith unit tests for integer overflow, oversized login tokens, negative participant counts before allocation, and existing sort behavior.Testing
mvn -q -Dtest=algorithms.sprint5.PyramidSortTest testwas run and passed after fixing a test invocation detail.mvn -q -DskipTests compilewas run and completed successfully.mvn -q test(full test suite) was run and completed successfully.Codex Task