mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-12-02 00:51:54 +00:00
GT-3261: Fixing possible IllegalArgumentException in sort comparator.
Integer subtraction could result in overflow.
This commit is contained in:
parent
f3e4cd0a00
commit
9edca9afec
@ -84,9 +84,11 @@ public class SymbolTableCommand extends LoadCommand {
|
||||
nlistList.add(NList.createNList(reader, is32bit));
|
||||
}
|
||||
// sort the entries by the index in the string table, so don't jump around reading
|
||||
List<NList> sortedList = nlistList.stream().sorted(
|
||||
(o1, o2) -> o1.getStringTableIndex() - o2.getStringTableIndex()).collect(
|
||||
Collectors.toList());
|
||||
List<NList> sortedList = nlistList
|
||||
.stream()
|
||||
.sorted((o1, o2) -> Integer.valueOf(o1.getStringTableIndex())
|
||||
.compareTo(Integer.valueOf(o2.getStringTableIndex())))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// initialize the NList strings from string table
|
||||
long stringTableOffset = stroff;
|
||||
|
@ -159,9 +159,11 @@ public class DyldCacheLocalSymbolsInfo implements StructConverter {
|
||||
monitor.incrementProgress(1);
|
||||
}
|
||||
// sort the entries by the index in the string table, so don't jump around reading
|
||||
List<NList> sortedList = nlistList.stream().sorted(
|
||||
(o1, o2) -> o1.getStringTableIndex() - o2.getStringTableIndex()).collect(
|
||||
Collectors.toList());
|
||||
List<NList> sortedList = nlistList
|
||||
.stream()
|
||||
.sorted((o1, o2) -> Integer.valueOf(o1.getStringTableIndex())
|
||||
.compareTo(Integer.valueOf(o2.getStringTableIndex())))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// initialize the NList strings from string table
|
||||
long stringTableOffset = startIndex + stringsOffset;
|
||||
|
Loading…
Reference in New Issue
Block a user