diff --git a/CHANGELOG.md b/CHANGELOG.md index 709c81a4b..6e515302c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. ### Added - Deobfuscation and its options as icons on script panel toolbar +### Fixed +- [#1904] NullpointerException when renaming invalid identifiers in AS1/2 files caused by missing charset + ## [18.0.0] - 2022-12-18 ### Added - [#1898] Keyboard shortcut to remove tags (DEL, SHIFT+DEL) @@ -2604,7 +2607,8 @@ All notable changes to this project will be documented in this file. ### Added - Initial public release -[Unreleased]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version17.0.4...dev +[Unreleased]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version18.0.0...dev +[18.0.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version17.0.4...version18.0.0 [17.0.4]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version17.0.3...version17.0.4 [17.0.3]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version17.0.2...version17.0.3 [17.0.2]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version17.0.1...version17.0.2 @@ -2739,6 +2743,7 @@ All notable changes to this project will be documented in this file. [alpha 9]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha8...alpha9 [alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8 [alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7 +[#1904]: https://www.free-decompiler.com/flash/issues/1904 [#1898]: https://www.free-decompiler.com/flash/issues/1898 [#1511]: https://www.free-decompiler.com/flash/issues/1511 [#1765]: https://www.free-decompiler.com/flash/issues/1765 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 797673d14..09e2ada77 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -2968,7 +2968,11 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { for (ASMSource src : actionsMap.keySet()) { actionsMap.get(src).removeNops(); - src.setActions(actionsMap.get(src)); + try { + src.setActions(actionsMap.get(src)); + } catch (ValueTooLargeException vtle) { + Logger.getLogger(SWF.class.getName()).log(Level.WARNING, "renaming AS2 identifiers failed for an action source with error: {0}", vtle.getMessage()); + } src.setModified(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java index 6f66bb686..f83f121a4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -93,6 +93,11 @@ public class ActionGraph extends Graph { this.insideDoInitAction = insideDoInitAction; this.insideFunction = insideFunction; } + + @Override + public ActionGraphSource getGraphCode() { + return (ActionGraphSource) code; + } @Override public LinkedHashMap getSubGraphs() { @@ -110,7 +115,7 @@ public class ActionGraph extends Graph { outs.add(new ActionList(((ActionGraphSource) code).getCharset())); continue; } - outs.add(new ActionList(alist.subList(adr2ip(alist, endAddr), adr2ip(alist, endAddr + size)))); + outs.add(new ActionList(alist.subList(adr2ip(alist, endAddr), adr2ip(alist, endAddr + size)), getGraphCode().getCharset())); endAddr += size; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java index 67e8bfb1b..71b6d2ee8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java @@ -60,7 +60,7 @@ public class ActionGraphSource extends GraphSource { } public ActionGraphSource(String path, boolean insideDoInitAction, List actions, int version, HashMap registerNames, HashMap variables, HashMap functions, String charset) { - this.actions = actions instanceof ActionList ? (ActionList) actions : new ActionList(actions); + this.actions = actions instanceof ActionList ? (ActionList) actions : new ActionList(actions, charset); this.version = version; this.registerNames = registerNames; this.variables = variables; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionList.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionList.java index 2b8803e6e..2a16a1ce8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionList.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionList.java @@ -63,8 +63,9 @@ public class ActionList extends ArrayList { } - public ActionList(Collection actions) { + public ActionList(Collection actions, String charset) { super(actions); + this.charset = charset; } public void setActions(List list) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 98b833f9d..62e76881c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -139,7 +139,7 @@ public class ActionListReader { nextOffsets.put(endAddress, endAddress + 1); } - ActionList actions = fixActionList(new ActionList(actionMap.values()), nextOffsets); + ActionList actions = fixActionList(new ActionList(actionMap.values(), sis.getCharset()), nextOffsets); // jump to the entry action when it is diffrent from the first action in the map if (entryAction != actions.get(0)) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/fastactionlist/FastActionList.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/fastactionlist/FastActionList.java index b164837ee..56044af6b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/fastactionlist/FastActionList.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/fastactionlist/FastActionList.java @@ -597,7 +597,7 @@ public class FastActionList implements Collection { List resultList = new ArrayList<>(size); ActionItem item = firstItem; if (item == null) { - return new ActionList(resultList); + return new ActionList(resultList, charset); } do { @@ -605,7 +605,7 @@ public class FastActionList implements Collection { item = item.next; } while (item != firstItem); - ActionList result = new ActionList(resultList); + ActionList result = new ActionList(resultList, charset); updateActionAddressesAndLengths(); updateJumps(); updateActionStores();