This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new 1eba02e  Throw an exception when an implicit narrowing conversion in a 
compound assignment would result in information loss or a numeric error such as 
an overflows.
     new dd1defb  Merge branch 'master' of 
https://gitbox.apache.org/repos/asf/commons-lang.git
1eba02e is described below

commit 1eba02e2a2734f7a6e8ca2338aa0897460da3e77
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Jan 30 15:19:28 2022 -0500

    Throw an exception when an implicit narrowing conversion in a compound
    assignment would result in information loss or a numeric error such as
    an overflows.
---
 src/changes/changes.xml                                     | 2 ++
 src/main/java/org/apache/commons/lang3/text/StrBuilder.java | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 3e82a40..0aef740 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -67,6 +67,8 @@ The <action> type attribute can be add,update,fix,remove.
     <action                   type="fix" dev="kinow" due-to="Roland 
Kreuzer">Javadoc for StringUtils.substringBefore(String str, int separator) 
doesn't mention that the separator is an int.</action>
     <action                   type="fix" dev="ggregory" due-to="Gary 
Gregory">Fix NullPointerException in ThreadUtils.getSystemThreadGroup() when 
the current thread is stopped.</action>
     <action                   type="fix" dev="ggregory" due-to="Gary 
Gregory">ArrayUtils.toPrimitive(Boolean...) null array elements map to false, 
like Boolean.parseBoolean(null) and its callers return false.</action>
+    <action                   type="fix" dev="ggregory" due-to="CodeQL, Gary 
Gregory">Throw an exception when an implicit narrowing conversion in a compound 
assignment would result in information loss or a numeric error such as an 
overflows.</action>
+    
     <!-- ADD -->
     <action                   type="add" dev="ggregory" due-to="Gary 
Gregory">Add EnumUtils.getEnumSystemProperty(...).</action>
     <action                   type="add" dev="ggregory" due-to="Gary 
Gregory">Add TriConsumer.</action>
diff --git a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java 
b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
index c5edc8b..5ed70db 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
@@ -2985,7 +2985,7 @@ public class StrBuilder implements CharSequence, 
Appendable, Serializable, Build
             if (n < 0) {
                 return 0;
             }
-            pos += n;
+            pos = Math.addExact(pos, Math.toIntExact(n));
             return n;
         }
 

Reply via email to