Skip to content

Fix OOM crash when importing large/corrupted .eap-config files - #180

Open
SanderVeer wants to merge 1 commit into
mainfrom
bugfix/eap-config-import-oom
Open

Fix OOM crash when importing large/corrupted .eap-config files#180
SanderVeer wants to merge 1 commit into
mainfrom
bugfix/eap-config-import-oom

Conversation

@SanderVeer

Copy link
Copy Markdown
Collaborator

Switch to the existing extensions.InputStream.readBytes(), which reads in fixed 4KB chunks instead of trusting available(). It was added alongside this same file-import feature but was never actually wired up, so the file was silently using the stdlib version all along causing crashes when importing .eap-config files with large logos included. Removing .close() as this was already handled by the extension function.

buildDeepLink() read the file with the stdlib InputStream.readBytes(),
which pre-sizes its ByteArrayOutputStream using available(). For some
content:// URIs that value is unreliable and can report a huge bogus
size, causing an immediate multi-hundred-MB allocation attempt and an
OutOfMemoryError (Crashlytics issue 375883fdcbf164622a8a6870d7988eba,
top crash of the last 30 days).

Switch to the existing extensions.InputStream.readBytes(), which reads
in fixed 4KB chunks instead of trusting available(). It was added
alongside this same file-import feature but was never actually wired
up, so the file was silently using the stdlib version all along.
@SanderVeer
SanderVeer requested a review from dzolnai August 7, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant