Repository navigation
Cap the size of an opened .eap-config file - #185
Merged
Merged
Conversation
On Chromebooks, opening an .eap-config file crashed with an OutOfMemoryError in readBytes (Crashlytics f4def939, 278 events in a week, all on 2.3.1(2693)). Every sampled event failed on the same 128 MB allocation, so the stream held more than 64 MB. The chunked reader from the earlier OOM fix buffered the whole stream with no limit, and Route.buildDeepLink only catches Exception, not OutOfMemoryError. readBytes now throws FileTooLargeException once the stream passes 10 MB, which buildDeepLink already catches. The user sees the "Not a valid .eap-config file" message instead of a crash. Real profiles are well below 1 MB. This adds the first unit test source set, with the JUnit alias in the version catalog.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change that caps .eap-config stream reads to prevent unbounded buffering.
No open issues 🎉
What changed in this PR
Caps .eap-config stream reads at 10 MiB to prevent unbounded buffering and let the existing error handler reject oversized files instead of crashing.
Changes:
- Adds a configurable read limit and
FileTooLargeException. - Adds unit tests for normal reads, size boundaries, endless streams, and stream closure when the limit is exceeded.
- Configures JUnit for the Android app’s first unit tests.
| File | Description |
|---|---|
gradle/libs.versions.toml |
Adds the JUnit library alias. |
android/app/src/test/java/app/eduroam/geteduroam/extensions/InputStreamTest.kt |
Tests bounded reads and stream cleanup. |
android/app/src/main/java/app/eduroam/geteduroam/extensions/InputStream.kt |
Enforces the read limit before buffering excess data. |
android/app/build.gradle.kts |
Adds JUnit as a test dependency. |
Review effort: Balanced
SanderVeer
marked this pull request as ready for review
November 6, 2026 14:48
dzolnai
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Chromebooks, opening an .eap-config file crashed with an OutOfMemoryError in readBytes (Crashlytics f4def939, 278 events in a week, all on 2.3.1(2693)). Every sampled event failed on the same 128 MB allocation, so the stream held more than 64 MB. The chunked reader from the earlier OOM fix buffered the whole stream with no limit, and Route.buildDeepLink only catches Exception, not OutOfMemoryError.
readBytes now throws FileTooLargeException once the stream passes 10 MB, which buildDeepLink already catches. The user sees the "Not a valid .eap-config file" message instead of a crash. Real profiles are well below 1 MB.
This adds the first unit test source set, with the JUnit alias in the version catalog.