mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-19 10:36:43 +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
2
.gitignore
vendored
2
.gitignore
vendored
@ -18,3 +18,5 @@ Server/src/main/java/META-INF/MANIFEST.MF
|
|||||||
.settings
|
.settings
|
||||||
.project
|
.project
|
||||||
.classpath
|
.classpath
|
||||||
|
# VSCode Workspace
|
||||||
|
.vscode/
|
@ -156,7 +156,14 @@ public class Assembler {
|
|||||||
|
|
||||||
//Unescape the string
|
//Unescape the string
|
||||||
String string = value.substring(1, value.length() - 1);
|
String string = value.substring(1, value.length() - 1);
|
||||||
|
|
||||||
|
try {
|
||||||
string = StringEscapeUtils.unescapeJava(string);
|
string = StringEscapeUtils.unescapeJava(string);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new InvalidOperandException(
|
||||||
|
"Invalid string operand \"" + string + "\": " + e.getMessage(),
|
||||||
|
currentLine);
|
||||||
|
}
|
||||||
|
|
||||||
out.write(string.getBytes(StandardCharsets.UTF_16BE));
|
out.write(string.getBytes(StandardCharsets.UTF_16BE));
|
||||||
} else if (labels != null && labels.containsKey(value)) {
|
} else if (labels != null && labels.containsKey(value)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user