Hi there,

I'm using SQlite 3.12.1 on Android device and we found this bug on most
Android devices.

The problem can be reproduced by following procedures:

1. Prepare a malformed Java String, like "123😂", then cut it right from
the middle of the surrogates, like "123😂".substring(0, 4), and append
other strings. The code (in Java) may result in:

String value = "123😂".substring(0, 4)+"\", \"another_key\":\"by_plus\"";

2. and then put it in SQLite db:

SQLiteOpenHelper sqliteHelper = new {some implement class};

ContentValues values = new ContentValues();
values.put("other_key", "other_values");
values.put("some_key", value);
values.put("other_key2", "other_values2");
sqliteHelper.getWritableDatabase().replace("some_table_name", null, values);

And after writing, we can see the wrong value, like:

123🐢, "another_key":"by_plus"

in this record.


Simply put, from the 4th byte to the 5th byte, we put data like
 11011000 00111101 00000000 00100010
in the db, but result in :
11110000 10011111 10010000 10100010
. We get different data before and after write into the db.

And I found another similar bug report before in
https://www.sqlite.org/src/tktview?name=3fe897352e , which says that
problem has been fixed, but this problem is still able to be reproduced on
version 3.12.1. Maybe we can learn from it to fix this problem.

Best,

Kelvin
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to