Fixed #1954 Incorrect calculation of empty button bounds causing OutOfMemory

This commit is contained in:
Jindra Petřík
2023-01-28 11:43:31 +01:00
parent 908e4907b4
commit e825ac20fc
3 changed files with 14 additions and 0 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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);
}