mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2025-01-07 13:48:00 -05:00
af360bc9ea
wgetc873988898
.patch -O telecomm-01.patch wget0fb5786dbf
.patch -O mediaprovider-01.patch wget1a4b9ef510
.patch -O wifi-01.patch wget364a1d9962
.patch -O bluetooth-01.patch wget87a06448b9
.patch -O settings-01.patch wgetaaba724a68
.patch -O settings-02.patch wget507304e1f5
.patch -O native-01.patch wget89489ff5dd
.patch -O base-01.patch wgetd1765c4715
.patch -O base-02.patch wgetcbb1a0ecd6
.patch -O base-03.patch wget4725772c0b
.patch -O base-04.patch wget19747f6923
.patch -O base-05.patch wgete7a1aa9ed0
.patch -O base-06.patch wget922a7860b1
.patch -O base-07.patch wgeted183ed912
.patch -O base-08.patch wgetc6fbe1330a
.patch -O base-09.patch wget9141cac175
.patch -O base-10.patch wget41235bcc67
.patch -O av-01.patch wgeta89f704701
.patch -O av-02.patch wget6d7cd80d77
.patch -O av-03.patch wget75fc175a08
.patch -O av-04.patch wgetb023ec300f
.patch -O av-05.patch wgetc8117d1539
.patch -O av-06.patch wgetf06d23d824
.patch -O av-07.patch wget9c7408ab07
.patch -O av-08.patch wgetcfbfcefb3c
.patch -O launcher-01.patch wget4a27a7f162
.patch -O libxml-01.patch Signed-off-by: Tad <tad@spotco.us>
60 lines
2.3 KiB
Diff
60 lines
2.3 KiB
Diff
From 922a7860b1baf29ff5cb53a31d01c341cd2b9ecb Mon Sep 17 00:00:00 2001
|
|
From: Kunal Malhotra <malhk@google.com>
|
|
Date: Fri, 2 Jun 2023 23:32:02 +0000
|
|
Subject: [PATCH] Fixing DatabaseUtils to detect malformed UTF-16 strings
|
|
|
|
Test: tested with POC in bug, also using atest
|
|
Bug: 224771621
|
|
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:fb4a72e3943d166088407e61aa4439ac349f3f12)
|
|
Merged-In: Ide65205b83063801971c5778af3154bcf3f0e530
|
|
Change-Id: Ide65205b83063801971c5778af3154bcf3f0e530
|
|
---
|
|
core/java/android/database/DatabaseUtils.java | 32 +++++++++++++------
|
|
1 file changed, 23 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/core/java/android/database/DatabaseUtils.java b/core/java/android/database/DatabaseUtils.java
|
|
index 6c8a8500e4e3..d41df4f49d48 100644
|
|
--- a/core/java/android/database/DatabaseUtils.java
|
|
+++ b/core/java/android/database/DatabaseUtils.java
|
|
@@ -511,17 +511,31 @@ public static void cursorFillWindow(final Cursor cursor,
|
|
*/
|
|
public static void appendEscapedSQLString(StringBuilder sb, String sqlString) {
|
|
sb.append('\'');
|
|
- if (sqlString.indexOf('\'') != -1) {
|
|
- int length = sqlString.length();
|
|
- for (int i = 0; i < length; i++) {
|
|
- char c = sqlString.charAt(i);
|
|
- if (c == '\'') {
|
|
- sb.append('\'');
|
|
+ int length = sqlString.length();
|
|
+ for (int i = 0; i < length; i++) {
|
|
+ char c = sqlString.charAt(i);
|
|
+ if (Character.isHighSurrogate(c)) {
|
|
+ if (i == length - 1) {
|
|
+ continue;
|
|
+ }
|
|
+ if (Character.isLowSurrogate(sqlString.charAt(i + 1))) {
|
|
+ // add them both
|
|
+ sb.append(c);
|
|
+ sb.append(sqlString.charAt(i + 1));
|
|
+ continue;
|
|
+ } else {
|
|
+ // this is a lone surrogate, skip it
|
|
+ continue;
|
|
}
|
|
- sb.append(c);
|
|
}
|
|
- } else
|
|
- sb.append(sqlString);
|
|
+ if (Character.isLowSurrogate(c)) {
|
|
+ continue;
|
|
+ }
|
|
+ if (c == '\'') {
|
|
+ sb.append('\'');
|
|
+ }
|
|
+ sb.append(c);
|
|
+ }
|
|
sb.append('\'');
|
|
}
|
|
|