diff --git a/CHANGELOG.md b/CHANGELOG.md index 75e653530..7e5263cc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file. - [#1951] Renaming invalid identifiers with existing string collisions - [#1888] String casts - ConvertS on XML, XMLList - [#1953] Save as EXE - add file extension when missing +- [#1954] Incorrect calculation of empty button bounds causing OutOfMemory ## [18.3.3] - 2023-01-22 ### Added @@ -2923,6 +2924,7 @@ All notable changes to this project will be documented in this file. [#1951]: https://www.free-decompiler.com/flash/issues/1951 [#1888]: https://www.free-decompiler.com/flash/issues/1888 [#1953]: https://www.free-decompiler.com/flash/issues/1953 +[#1954]: https://www.free-decompiler.com/flash/issues/1954 [#1913]: https://www.free-decompiler.com/flash/issues/1913 [#1894]: https://www.free-decompiler.com/flash/issues/1894 [#1801]: https://www.free-decompiler.com/flash/issues/1801 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java index 1648ab71c..1bb4d1875 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java @@ -207,6 +207,7 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer { } RECT rect = new RECT(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE); + boolean foundSomething = false; for (BUTTONRECORD r : characters) { CharacterTag ch = swf.getCharacter(r.characterId); if (ch instanceof BoundedTag) { @@ -223,9 +224,14 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer { rect.Ymin = Math.min(r2.Ymin, rect.Ymin); rect.Xmax = Math.max(r2.Xmax, rect.Xmax); rect.Ymax = Math.max(r2.Ymax, rect.Ymax); + foundSomething = true; } } } + + if (!foundSomething) { + rect = new RECT(); + } if (cache != null) { cache.put(this, rect); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java index 44d579301..74aaf23d8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java @@ -195,6 +195,7 @@ public class DefineButtonTag extends ButtonTag implements ASMSourceContainer { } RECT rect = new RECT(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE); + boolean foundSomething = false; for (BUTTONRECORD r : characters) { CharacterTag ch = swf.getCharacter(r.characterId); if (ch instanceof BoundedTag) { @@ -211,10 +212,15 @@ public class DefineButtonTag extends ButtonTag implements ASMSourceContainer { rect.Ymin = Math.min(r2.Ymin, rect.Ymin); rect.Xmax = Math.max(r2.Xmax, rect.Xmax); rect.Ymax = Math.max(r2.Ymax, rect.Ymax); + foundSomething = true; } } } + if (!foundSomething) { + rect = new RECT(); + } + if (cache != null) { cache.put(this, rect); }