Browse Source

size comparator was vulnerable to integer overflows. PR 54623

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1452022 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 12 years ago
parent
commit
db63447739
2 changed files with 6 additions and 1 deletions
  1. +4
    -0
      WHATSNEW
  2. +2
    -1
      src/main/org/apache/tools/ant/types/resources/comparators/Size.java

+ 4
- 0
WHATSNEW View File

@@ -77,6 +77,10 @@ Fixed bugs:
* Base64Converter not properly handling bytes with MSB set (not masking byte to int conversion)
Bugzilla Report 54460

* The size resource comparator would return wrong results if file
sizes differed by more than 2 GB.
Bugzilla Report 54623

Other changes:
--------------



+ 2
- 1
src/main/org/apache/tools/ant/types/resources/comparators/Size.java View File

@@ -32,7 +32,8 @@ public class Size extends ResourceComparator {
* argument is less than, equal to, or greater than the second.
*/
protected int resourceCompare(Resource foo, Resource bar) {
return (int) (foo.getSize() - bar.getSize());
long diff = foo.getSize() - bar.getSize();
return diff > 0 ? 1 : (diff == 0 ? 0 : -1);
}

}

Loading…
Cancel
Save