mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-26 14:12:17 +00:00
GP-4166 fix unicodescript issue in search for encoded strings dlg
Fix duplicate <any> elements showing up in script list.
This commit is contained in:
parent
93adc70757
commit
2f8d273eff
@ -29,9 +29,9 @@ public class CharacterScriptUtils {
|
||||
|
||||
/**
|
||||
* The {@link UnicodeScript} value that represents the "ANY" choice. This is a bit of a hack
|
||||
* and re-uses the INHERITED enum value for this purpose.
|
||||
* and re-uses the enum value for this purpose.
|
||||
*/
|
||||
public static final UnicodeScript ANY_SCRIPT_ALIAS = UnicodeScript.INHERITED;
|
||||
public static final UnicodeScript ANY_SCRIPT_ALIAS = UnicodeScript.UNKNOWN;
|
||||
|
||||
/**
|
||||
* Premade examples of characters from each specified script, using info from
|
||||
|
@ -1063,7 +1063,11 @@ public class EncodedStringsDialog extends DialogComponentProvider {
|
||||
|
||||
private ComboBoxModel<UnicodeScript> getScriptListModel(EncodedStringsFilterStats stats) {
|
||||
List<UnicodeScript> scripts = new ArrayList<>(stats.foundScriptCounts.keySet());
|
||||
Collections.sort(scripts, (us1, us2) -> us1.name().compareTo(us2.name()));
|
||||
Collections.sort(scripts, (us1, us2) -> {
|
||||
int us1Count = stats.foundScriptCounts.get(us1);
|
||||
int us2Count = stats.foundScriptCounts.get(us2);
|
||||
return Integer.compare(us2Count, us1Count); // descending
|
||||
});
|
||||
scripts.add(0, CharacterScriptUtils.ANY_SCRIPT_ALIAS);
|
||||
|
||||
return new DefaultComboBoxModel<>(new Vector<>(scripts));
|
||||
|
@ -48,7 +48,12 @@ public record StringInfo(
|
||||
s.codePoints().forEach(codePoint -> {
|
||||
try {
|
||||
UnicodeScript script = Character.UnicodeScript.of(codePoint);
|
||||
scripts.add(script);
|
||||
if (script == UnicodeScript.UNKNOWN) {
|
||||
features.add(StringInfoFeature.CODEC_ERROR); // TODO: are we mis-using this enum to signal bad character?
|
||||
}
|
||||
else {
|
||||
scripts.add(script);
|
||||
}
|
||||
|
||||
if (codePoint == StringUtilities.UNICODE_REPLACEMENT) {
|
||||
features.add(StringInfoFeature.CODEC_ERROR);
|
||||
|
Loading…
Reference in New Issue
Block a user