Skip to content

Commit 83ffa93

Browse files
committed
fix off-by-one error in utf8 logic (thanks copilot!)
1 parent 0cf7a45 commit 83ffa93

File tree

1 file changed

+3
-4
lines changed
  • firebase-firestore/src/main/java/com/google/firebase/firestore/util

1 file changed

+3
-4
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/util/Utf8Compare.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
// package com.google.firebase.firestore.util;
1514

1615
package com.google.firebase.firestore.util;
1716

@@ -87,11 +86,11 @@ public static int compareUtf8Strings(String left, String right) {
8786
} else if (rightChar < 0x80) {
8887
return 1;
8988
}
90-
if (leftChar < 0x7FF && rightChar < 0x7FF) {
89+
if (leftChar < 0x800 && rightChar < 0x800) {
9190
return compare2ByteUtf8Encoding(leftChar, rightChar);
92-
} else if (leftChar < 0x7FF) {
91+
} else if (leftChar < 0x800) {
9392
return -1;
94-
} else if (rightChar < 0x7FF) {
93+
} else if (rightChar < 0x800) {
9594
return 1;
9695
}
9796
if (isSurrogate(leftChar) && isSurrogate((rightChar))) {

0 commit comments

Comments
 (0)