diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java index fd3f3ed0e..fdfbf6afd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java @@ -77,8 +77,12 @@ public class ActionConstantPool extends Action { */ @Override protected int getContentBytesLength() { + return calculateSize(constantPool); + } + + public static int calculateSize(List strings) { int res = 2; - for (String s : constantPool) { + for (String s : strings) { res += Utf8Helper.getBytesLength(s) + 1; } diff --git a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index 5f25d66ff..511e1e50f 100644 --- a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -30,6 +30,7 @@ import com.jpexs.decompiler.flash.action.parser.script.ParsedSymbol; import com.jpexs.decompiler.flash.action.parser.script.SymbolType; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.action.swf4.ConstantIndex; +import com.jpexs.decompiler.flash.action.swf5.ActionConstantPool; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; import com.jpexs.decompiler.flash.gui.AppStrings; @@ -786,7 +787,16 @@ public class ActionPanel extends JPanel implements SearchListener> constantPools = Helper.getConstantPoolsFromText(text); + for (int i = 0; i < constantPools.size(); i++) { + List constantPool = constantPools.get(i); + int size = ActionConstantPool.calculateSize(constantPool); + if (size > 0xffff) { + View.showMessageDialog(this, AppStrings.translate("error.constantPoolTooBig").replace("%index%", Integer.toString(i)).replace("%size%", Integer.toString(size)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); + } + } + + src.setConstantPools(constantPools); } else { src.setActions(ASMParser.parse(0, true, text, src.getSwf().version, false)); } @@ -806,6 +816,8 @@ public class ActionPanel extends JPanel implements SearchListener