elharo opened a new issue, #152:
URL: https://github.com/apache/maven-jarsigner-plugin/issues/152

   **Affected version:** HEAD
   
   **File:** 
`src/main/java/org/apache/maven/plugins/jarsigner/JarsignerSignMojo.java:414-428`
   
   The `waitAfterFailure()` method uses `Math.min(attempt, 
MAX_WAIT_EXPONENT_ATTEMPT)` where `MAX_WAIT_EXPONENT_ATTEMPT = 20`. For 
negative attempt values (e.g., `Integer.MIN_VALUE`), this produces a negative 
exponent:
   
   ```java
   int exponentAttempt = Math.min(attempt, MAX_WAIT_EXPONENT_ATTEMPT);
   long delayMillis = (long) (Duration.ofSeconds(1).toMillis() * Math.pow(2, 
exponentAttempt));
   ```
   
   For `attempt = Integer.MIN_VALUE`, `Math.min(Integer.MIN_VALUE, 20)` = 
`Integer.MIN_VALUE`, and `Math.pow(2, Integer.MIN_VALUE)` returns a fractional 
value near 0, so the resulting `delayMillis` is 0. While this doesn't cause a 
crash, the pattern is fragile and produces unexpected behavior for edge-case 
inputs. The fix should clamp `attempt` to at least 0.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to