8000 Don't use writeByteArray() in xposed_service.cpp · CJavaScala/Xposed@46cedbc · GitHub
[go: up one dir, main page]

Skip to content

Commit 46cedbc

Browse files
romracerrovo89
authored andcommitted
Don't use writeByteArray() in xposed_service.cpp
This works around an AOSP bug. Byte arrays first store the array size and then the bytes. However, Parcel::writeByteArray() uses size_t for the size, whereas all other parts related to Parcels read/write int32_t values. This leads to conflicts on 64-bit ROMs, as size_t uses 4 bytes instead of 4 bytes here. In Xposed, this results in invalid file reads, most notably in XSharedPreferences. This fixes rovo89/XposedBridge#58. Thanks to @rsteckler for reporting this issue and testing the fix!
1 parent 40de1cc commit 46cedbc

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

xposed_service.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,12 +581,8 @@ status_t BnXposedService::onTransact(uint32_t code, const Parcel& data, Parcel*
581581
reply->writeInt64(size);
582582
reply->writeInt64(mtime);
583583
if (bytesRead > 0) {
584-
#if PLATFORM_SDK_VERSION >= 21
585-
reply->writeByteArray(bytesRead, buffer);
586-
#else
587584
reply->writeInt32(bytesRead);
588585
reply->write(buffer, bytesRead);
589-
#endif
590586
free(buffer);
591587
} else {
592588
reply->writeInt32(bytesRead); // empty array (0) or null (-1)

0 commit comments

Comments
 (0)
0