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

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