mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-10 14:26:45 +00:00
Merge pull request #171 from Francessco121/bug/unicode-string-crash
Fix assembler crash when invalid Unicode string escape sequences are used
This commit is contained in:
commit
a1cf279b6f
4
.gitignore
vendored
4
.gitignore
vendored
@ -17,4 +17,6 @@ Server/Server.iml
|
||||
Server/src/main/java/META-INF/MANIFEST.MF
|
||||
.settings
|
||||
.project
|
||||
.classpath
|
||||
.classpath
|
||||
# VSCode Workspace
|
||||
.vscode/
|
@ -156,7 +156,14 @@ public class Assembler {
|
||||
|
||||
//Unescape the string
|
||||
String string = value.substring(1, value.length() - 1);
|
||||
string = StringEscapeUtils.unescapeJava(string);
|
||||
|
||||
try {
|
||||
string = StringEscapeUtils.unescapeJava(string);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new InvalidOperandException(
|
||||
"Invalid string operand \"" + string + "\": " + e.getMessage(),
|
||||
currentLine);
|
||||
}
|
||||
|
||||
out.write(string.getBytes(StandardCharsets.UTF_16BE));
|
||||
} else if (labels != null && labels.containsKey(value)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user