mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
GP-2941 better defined string iterator
Don't iterate arrays that can't contain a string. When iterating a struct, only look at defined fields. Should address issues #8134, #5726, #3498
This commit is contained in:
parent
a1b6084c88
commit
c70de2b590
11 changed files with 442 additions and 81 deletions
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -20,8 +20,7 @@ import ghidra.app.script.GhidraScript;
|
|||
import ghidra.program.model.data.StringDataInstance;
|
||||
import ghidra.program.model.data.TranslationSettingsDefinition;
|
||||
import ghidra.program.model.listing.Data;
|
||||
import ghidra.program.util.DefinedDataIterator;
|
||||
import util.CollectionUtils;
|
||||
import ghidra.program.util.DefinedStringIterator;
|
||||
|
||||
public class TranslateStringsScript extends GhidraScript {
|
||||
|
||||
|
@ -40,8 +39,7 @@ public class TranslateStringsScript extends GhidraScript {
|
|||
int count = 0;
|
||||
monitor.initialize(currentProgram.getListing().getNumDefinedData());
|
||||
monitor.setMessage("Translating strings");
|
||||
for (Data data : CollectionUtils.asIterable(
|
||||
DefinedDataIterator.definedStrings(currentProgram, currentSelection))) {
|
||||
for (Data data : DefinedStringIterator.forProgram(currentProgram, currentSelection)) {
|
||||
if (monitor.isCancelled()) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue