Skip to content

Commit

Permalink
GP-4339 fixed memory access exception in VT MatchData
Browse files Browse the repository at this point in the history
  • Loading branch information
ghidra007 committed Mar 4, 2024
1 parent 59a048f commit f3b1f78
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
*/
package ghidra.app.plugin.match;

import java.util.*;

import generic.stl.Pair;
import ghidra.program.model.address.*;
import ghidra.program.model.listing.*;
import ghidra.program.model.mem.MemoryAccessException;
import ghidra.util.Msg;
import ghidra.util.exception.CancelledException;
import ghidra.util.search.trie.*;
import ghidra.util.task.TaskMonitor;

import java.util.*;

public class MatchData {
private MatchData() {
// non-instantiable
Expand Down Expand Up @@ -80,7 +81,10 @@ private static ByteTrieIfc<Pair<Set<Address>, Set<Address>>> extractSourceHashes
bytes = aData.getBytes();
}
catch (MemoryAccessException e) {
throw new RuntimeException(e);
// if all the bytes for this data cannot be accessed then skip it
Msg.warn(MatchData.class, "Cannot process data at " + aData.getAddress() +
" because it runs into uninitialized memory.");
continue;
}
byte first = bytes[0];
for (int ii = 1; ii < bytes.length; ++ii) {
Expand All @@ -97,7 +101,10 @@ private static ByteTrieIfc<Pair<Set<Address>, Set<Address>>> extractSourceHashes
bytes = aData.getBytes();
}
catch (MemoryAccessException e) {
throw new RuntimeException(e);
// if all the bytes for this data cannot be accessed then skip it
Msg.warn(MatchData.class, "Cannot process data at " +
aData.getAddress() + " because it runs into uninitialized memory.");
continue;
}
}
ByteTrieNodeIfc<Pair<Set<Address>, Set<Address>>> node = trie.find(bytes);
Expand Down

0 comments on commit f3b1f78

Please sign in to comment.