Open dipshit-enterprises opened 1 week ago
I have investigated the issue and it seems to be caused by the apache commons http library allocating the entire request body if not given the content length.
I have a potential fix, I'll make a PR once I test it.
⚠️ Before posting ⚠️
Steps to reproduce
using the nextcloud/Android-SingleSignOn library:
Expected behaviour
The Nextcloud Files app copies a fixed/limited number of bytes from the request body's buffer from my app over the AIDL interface, making sure the bytes hit my Nextcloud server before reading more so that it doesn't run out of memory.
Actual behaviour
The Nextcloud Files app instead reads as much of the buffer as possible from my app over the AIDL interface with no limits and without waiting for the bytes to hit my server. It quickly approaches the JVM limit within seconds and crashes, as my app is able to provide the data much faster than it can be uploaded to my server.
Android version
13
Device brand and model
samsung SM-G975F
Stock or custom OS?
Custom (explain in "additional information")
Nextcloud android app version
3.29.1
Nextcloud server version
28.0.7
Using a reverse proxy?
Yes
Android logs
Server error logs
Additional information
Please note that despite using the library, the crash is within the Nextcloud Files app, and I believe this is a result of how the Nextcloud Files app handles the requests.
In the provided logcat, the file transfer made it to 268.57 MB before running out of memory.
Custom OS info: I am running Lineage OS 20, compiled by myself