You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "hiSandog (via GitHub)" <gi...@apache.org> on 2026/05/30 15:43:14 UTC

[PR] Fix byte integer converter overflow [pulsar]

hiSandog opened a new pull request, #25901:
URL: https://github.com/apache/pulsar/pull/25901

   ### Motivation
   
   ByteUnitToIntegerConverter silently truncated byte sizes larger than Integer.MAX_VALUE because it cast the parsed long to int.
   
   ### Modifications
   
   Use Math.toIntExact so overflowing values are rejected as conversion errors, and split the converter tests to cover valid int-sized values separately from overflow cases.
   
   ### Verifications
   
   - git diff --check
   - ./gradlew :pulsar-cli-utils:test --tests org.apache.pulsar.cli.converters.ByteConversionTest (could not run locally: Java Runtime not found)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix][misc] Throw TypeConversionException when ByteUnitToIntegerConverter's long->int conversion overflows [pulsar]

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari merged PR #25901:
URL: https://github.com/apache/pulsar/pull/25901


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix][misc] Throw TypeConversionException when ByteUnitToIntegerConverter's long->int conversion overflows [pulsar]

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #25901:
URL: https://github.com/apache/pulsar/pull/25901#issuecomment-4614193059

   The current impact of this is when someone would try to set an invalid value for `--maxBlockSize` or `--readBufferSize` for `pulsar-admin namespaces set-offload-policies` or `pulsar-admin topicPolicies set-offload-policies`. It's not a realistic scenario, but it is possible.
   @hiSandog I'm assuming that you are catching these issues with static analysis or AI analysis of the code base and not in actual use cases?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org