diff --git a/CHANGELOG.md b/CHANGELOG.md index c5b24b25b..5e8c42ea7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ All notable changes to this project will be documented in this file. - AS3 try..catch inside loop unneccessary continue - [#2077] AS3 colliding types in current package with trait names - NullPointer on reload / uncache +- [#2076] Auto rename identifiers infinite loop caused by renaming in playerglobal library ### Changed - [#2070] String values inside SWF to XML export are backslash escaped @@ -3093,6 +3094,7 @@ Major version of SWF to XML export changed to 2. [#2072]: https://www.free-decompiler.com/flash/issues/2072 [#2029]: https://www.free-decompiler.com/flash/issues/2029 [#2077]: https://www.free-decompiler.com/flash/issues/2077 +[#2076]: https://www.free-decompiler.com/flash/issues/2076 [#1998]: https://www.free-decompiler.com/flash/issues/1998 [#2038]: https://www.free-decompiler.com/flash/issues/2038 [#2028]: https://www.free-decompiler.com/flash/issues/2028 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 382ef55d5..5aa004bf4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -502,14 +502,16 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { if (Configuration.getPlayerSWC() != null) { SWC swc = new SWC(new FileInputStream(Configuration.getPlayerSWC())); - SWF swf = new SWF(swc.getOpenable("library.swf"), true); + //set allowRenameIdentifiers parameter to FALSE otherwise there will be an infinite loop + SWF swf = new SWF(swc.getOpenable("library.swf"), null, null, null, true, false, true, null, Charset.defaultCharset().name(), false); playerGlobalAbcIndex = new AbcIndexing(swf); } } if (airGlobalAbcIndex == null) { if (Configuration.getAirSWC() != null) { SWC swc = new SWC(new FileInputStream(Configuration.getAirSWC())); - SWF swf = new SWF(swc.getOpenable("library.swf"), true); + //set allowRenameIdentifiers to FALSE + SWF swf = new SWF(swc.getOpenable("library.swf"), null, null, null, true, false, true, null, Charset.defaultCharset().name(), false); airGlobalAbcIndex = new AbcIndexing(swf); } } @@ -1452,17 +1454,20 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { } public SWF(InputStream is, String file, String fileTitle, ProgressListener listener, boolean parallelRead, boolean checkOnly, boolean lazy, String charset) throws IOException, InterruptedException { - this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, null, charset); + this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, null, charset, true); } public SWF(InputStream is, String file, String fileTitle, ProgressListener listener, boolean parallelRead, boolean checkOnly, boolean lazy) throws IOException, InterruptedException { - this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, null, Charset.defaultCharset().name()); + this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, null, Charset.defaultCharset().name(), true); } public SWF(InputStream is, String file, String fileTitle, ProgressListener listener, boolean parallelRead, boolean checkOnly, boolean lazy, UrlResolver resolver) throws IOException, InterruptedException { - this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, resolver, Charset.defaultCharset().name()); + this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, resolver, Charset.defaultCharset().name(), true); } + public SWF(InputStream is, String file, String fileTitle, ProgressListener listener, boolean parallelRead, boolean checkOnly, boolean lazy, UrlResolver resolver, String charset) throws IOException, InterruptedException { + this(is, file, fileTitle, listener, parallelRead,checkOnly, lazy, resolver, charset, true); + } /** * Construct SWF from stream * @@ -1474,10 +1479,12 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { * @param checkOnly Check only file validity * @param lazy * @param resolver Resolver for imported tags + * @param charset Character set for all texts (for older SWF versions) + * @param allowRenameIdentifiers Allow auto renaming identifiers when enabled * @throws IOException * @throws java.lang.InterruptedException */ - public SWF(InputStream is, String file, String fileTitle, ProgressListener listener, boolean parallelRead, boolean checkOnly, boolean lazy, UrlResolver resolver, String charset) throws IOException, InterruptedException { + public SWF(InputStream is, String file, String fileTitle, ProgressListener listener, boolean parallelRead, boolean checkOnly, boolean lazy, UrlResolver resolver, String charset, boolean allowRenameIdentifiers) throws IOException, InterruptedException { this.file = file; this.fileTitle = fileTitle; this.charset = charset; @@ -1538,7 +1545,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { } } - if (Configuration.autoRenameIdentifiers.get()) { + if (allowRenameIdentifiers && Configuration.autoRenameIdentifiers.get()) { deobfuscateIdentifiers(RenameType.TYPENUMBER); AbcMultiNameCollisionFixer collisionFixer = new AbcMultiNameCollisionFixer(); collisionFixer.fixCollisions(this);