mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-05 11:44:33 +00:00
Added: #2519 AS1/2 P-code editation - better handling of "too large" error messages
This commit is contained in:
@@ -22,6 +22,7 @@ All notable changes to this project will be documented in this file.
|
||||
- [#2499] Information about frames which do not have ShowFrame tag
|
||||
- [#2504] WebP image format for export/import (not animated)
|
||||
Limitation: It's not available on Mac x86-64 platform
|
||||
- [#2519] AS1/2 P-code editation - better handling of "too large" error messages
|
||||
|
||||
### Fixed
|
||||
- [#2474] Gotos incorrectly decompiled
|
||||
@@ -3969,6 +3970,7 @@ Major version of SWF to XML export changed to 2.
|
||||
[#2485]: https://www.free-decompiler.com/flash/issues/2485
|
||||
[#2499]: https://www.free-decompiler.com/flash/issues/2499
|
||||
[#2504]: https://www.free-decompiler.com/flash/issues/2504
|
||||
[#2519]: https://www.free-decompiler.com/flash/issues/2519
|
||||
[#2474]: https://www.free-decompiler.com/flash/issues/2474
|
||||
[#2480]: https://www.free-decompiler.com/flash/issues/2480
|
||||
[#2338]: https://www.free-decompiler.com/flash/issues/2338
|
||||
@@ -3988,7 +3990,6 @@ Major version of SWF to XML export changed to 2.
|
||||
[#2515]: https://www.free-decompiler.com/flash/issues/2515
|
||||
[#2516]: https://www.free-decompiler.com/flash/issues/2516
|
||||
[#2517]: https://www.free-decompiler.com/flash/issues/2517
|
||||
[#2519]: https://www.free-decompiler.com/flash/issues/2519
|
||||
[#2476]: https://www.free-decompiler.com/flash/issues/2476
|
||||
[#2404]: https://www.free-decompiler.com/flash/issues/2404
|
||||
[#1418]: https://www.free-decompiler.com/flash/issues/1418
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.parser.pcode;
|
||||
|
||||
import com.jpexs.decompiler.flash.ValueTooLargeException;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.flashlite.ActionFSCommand2;
|
||||
@@ -386,7 +387,12 @@ public class ASMParser {
|
||||
throw new ActionParseException("Block end without start", lexer.yyline());
|
||||
}
|
||||
GraphSourceItemContainer a = containers.peek();
|
||||
if (!a.parseDivision(0, lexer)) {
|
||||
if (!a.parseDivision(0, lexer)) {
|
||||
try {
|
||||
((Action) a).getBytes(version);
|
||||
} catch (ValueTooLargeException vtl) {
|
||||
throw new ActionParseException("Action container is too large", lexer.yyline());
|
||||
}
|
||||
containers.pop();
|
||||
}
|
||||
} else if (symb.type == ASMParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
@@ -394,6 +400,12 @@ public class ASMParser {
|
||||
Action a = parseAction(instructionName, lexer, emptyList, version, charset);
|
||||
if (a instanceof GraphSourceItemContainer) {
|
||||
containers.push((GraphSourceItemContainer) a);
|
||||
} else if (a != null) {
|
||||
try {
|
||||
((Action) a).getBytes(version);
|
||||
} catch (ValueTooLargeException vtl) {
|
||||
throw new ActionParseException("Action is too large", lexer.yyline());
|
||||
}
|
||||
}
|
||||
if (a != null) {
|
||||
list.add(a);
|
||||
@@ -455,6 +467,12 @@ public class ASMParser {
|
||||
GraphSourceItemContainer a = containers.peek();
|
||||
if (!a.parseDivision(address - ((Action) a).getAddress(), lexer)) {
|
||||
containers.pop();
|
||||
|
||||
try {
|
||||
((Action) a).getBytes(version);
|
||||
} catch (ValueTooLargeException vtl) {
|
||||
throw new ActionParseException("Action container is too large", lexer.yyline());
|
||||
}
|
||||
}
|
||||
} else if (symb.type == ASMParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
String instructionName = (String) symb.value;
|
||||
@@ -474,6 +492,12 @@ public class ASMParser {
|
||||
}
|
||||
if (a instanceof GraphSourceItemContainer) {
|
||||
containers.push((GraphSourceItemContainer) a);
|
||||
} else if (a != null) {
|
||||
try {
|
||||
((Action) a).getBytes(version);
|
||||
} catch (ValueTooLargeException vtl) {
|
||||
throw new ActionParseException("Action is too large", lexer.yyline());
|
||||
}
|
||||
}
|
||||
if (a != null) {
|
||||
list.add(a);
|
||||
@@ -533,7 +557,7 @@ public class ASMParser {
|
||||
if (actionJump.identifier.equals(label.name)) {
|
||||
int offset = (int) (label.address - (actionJump.getAddress() + actionJump.getTotalActionLength()));
|
||||
if (offset < -0x8000 || offset > 0x7fff) {
|
||||
String message = "Jump offset is too large:" + offset + " addr: ofs" + Helper.formatAddress(link.getAddress());
|
||||
String message = "ActionJump offset is too large. offset: " + offset + ", jump action addr: ofs" + Helper.formatAddress(link.getAddress())+", target label: " + label.name;
|
||||
if (throwOnError) {
|
||||
Integer line = lineMap.get(link);
|
||||
if (line == null) {
|
||||
@@ -559,7 +583,7 @@ public class ASMParser {
|
||||
if (actionIf.identifier.equals(label.name)) {
|
||||
int offset = (int) (label.address - (actionIf.getAddress() + actionIf.getTotalActionLength()));
|
||||
if (offset < -0x8000 || offset > 0x7fff) {
|
||||
String message = "If offset is too large:" + offset + " addr: ofs" + Helper.formatAddress(link.getAddress());
|
||||
String message = "ActionIf offset is too large. offset: " + offset + ", jump action addr: ofs" + Helper.formatAddress(link.getAddress())+", target label: " + label.name;
|
||||
if (throwOnError) {
|
||||
Integer line = lineMap.get(link);
|
||||
if (line == null) {
|
||||
|
||||
@@ -1394,9 +1394,10 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
Action.setConstantPools(src, constantPools, true);
|
||||
} catch (ConstantPoolTooBigException ex) {
|
||||
ViewMessages.showMessageDialog(this, AppStrings.translate("error.constantPoolTooBig").replace("%index%", Integer.toString(ex.index)).replace("%size%", Integer.toString(ex.size)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
src.setActions(ASMParser.parse(0, true, text, src.getSwf().version, false, src.getSwf().getCharset()));
|
||||
src.setActions(ASMParser.parse(0, true, text, src.getSwf().version, true, src.getSwf().getCharset()));
|
||||
}
|
||||
|
||||
SWF.uncache(src);
|
||||
@@ -1420,6 +1421,8 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
editor.gotoLine((int) ex.line);
|
||||
editor.markError();
|
||||
ViewMessages.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
} catch (ValueTooLargeException vl) {
|
||||
ViewMessages.showMessageDialog(this, AppStrings.translate("error.action.save.valueTooLarge"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
} catch (Throwable ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user