[
https://issues.apache.org/jira/browse/HADOOP-17711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18041406#comment-18041406
]
ASF GitHub Bot commented on HADOOP-17711:
-----------------------------------------
github-actions[bot] commented on PR #3048:
URL: https://github.com/apache/hadoop/pull/3048#issuecomment-3590739479
We're closing this stale PR because it has been open for 100 days with no
activity. This isn't a judgement on the merit of the PR in any way. It's just a
way of keeping the PR queue manageable.
If you feel like this was a mistake, or you would like to continue working
on it, please feel free to re-open it and ask for a committer to remove the
stale tag and review again.
Thanks all for your contribution.
> A divide by zero bug in LoadBalancingKMSClientProvider.java
> -----------------------------------------------------------
>
> Key: HADOOP-17711
> URL: https://issues.apache.org/jira/browse/HADOOP-17711
> Project: Hadoop Common
> Issue Type: Bug
> Components: kms
> Reporter: Yiyuan GUO
> Priority: Major
> Labels: easyfix, pull-request-available, security
> Original Estimate: 1h
> Time Spent: 1h
> Remaining Estimate: 0h
>
> In the file _kms/LoadBalancingKMSClientProvider.java_, the function
> _rollNewVersion_ has the following
> [code|https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/LoadBalancingKMSClientProvider.java#L509-#L516]:
>
> {code:java}
> @Override
> public KeyVersion rollNewVersion(final String name, final byte[] material)
> throws IOException {
> final KeyVersion newVersion = doOp(new ProviderCallable<KeyVersion>() {
> @Override
> public KeyVersion call(KMSClientProvider provider) throws IOException {
> return provider.rollNewVersion(name, material);
> }
> }, nextIdx(), false);
> ...
> }
> {code}
> The function _nextIdx_ uses _providers.length_ as a divisor:
> {code:java}
> private int nextIdx() {
> while (true) {
> int current = currentIdx.get();
> int next = (current + 1) % providers.length;
> ......
> }{code}
> However, _providers.length_ may be equal to zero, since the function _doOp_
> explicitly checks that and throws an exception when it happens:
> {code:java}
> private <T> T doOp(ProviderCallable<T> op, int currPos,
> boolean isIdempotent) throws IOException {
> if (providers.length == 0) {
> throw new IOException("No providers configured !");
> }
> ...
> }
> {code}
>
> The problem is that when _providers.length_ is 0, a divide by zero problem
> will happen when computing the argument for _doOp_ (inside the function
> _nextIdx_) before reaching the protection check above, causing an
> ArithmeticException.
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]