[fix](fe) Inconsistent behavior for string comparison in FE and BE (#13604)

This commit is contained in:
xueweizhang
2022-11-02 15:32:13 +08:00
committed by GitHub
parent 6f3db8b4b4
commit f2a0adf34e
3 changed files with 6 additions and 2 deletions

View File

@ -96,9 +96,9 @@ public class StringLiteral extends LiteralExpr {
int minLength = Math.min(thisBytes.length, otherBytes.length);
int i = 0;
for (i = 0; i < minLength; i++) {
if (thisBytes[i] < otherBytes[i]) {
if (Byte.toUnsignedInt(thisBytes[i]) < Byte.toUnsignedInt(otherBytes[i])) {
return -1;
} else if (thisBytes[i] > otherBytes[i]) {
} else if (Byte.toUnsignedInt(thisBytes[i]) > Byte.toUnsignedInt(otherBytes[i])) {
return 1;
}
}