-
-
Notifications
You must be signed in to change notification settings - Fork 98
Fixed issue with some Epic Games not downloading (Required Header version parsing) #483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed issue with some Epic Games not downloading (Required Header version parsing) #483
Conversation
…chunks. Two different specs, 62 bytes and 66 byte headers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 1 file
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="app/src/main/java/app/gamenative/service/epic/EpicDownloadManager.kt">
<violation number="1" location="app/src/main/java/app/gamenative/service/epic/EpicDownloadManager.kt:686">
P2: `headerSize` is read from the chunk file and only checked for a minimum. A large/corrupt value will lead to `ByteArray(remainingSize)` allocating an unbounded amount of memory, which can crash the app. Add an upper bound on the header size before allocating.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
app/src/main/java/app/gamenative/service/epic/EpicDownloadManager.kt
Outdated
Show resolved
Hide resolved
…ger.kt Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
📝 WalkthroughWalkthroughModifies header parsing in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Failure to add the new IP will result in interrupted reviews. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@app/src/main/java/app/gamenative/service/epic/EpicDownloadManager.kt`:
- Around line 684-688: The header size validation in EpicDownloadManager
(variable headerSize) currently allows any value between 62 and 66, but only
exact sizes 62 or 66 are valid; update the check to enforce (headerSize == 62 ||
headerSize == 66) and throw an Exception when not one of those exact values, and
adjust the exception message to state "Invalid header size: X (expected 62 or 66
bytes)" to make the constraint explicit; locate and modify the validation block
around headerSize in EpicDownloadManager.kt.
| // Epic chunks can have different header sizes (62 or 66 bytes) | ||
| // Minimum viable header is 62 bytes | ||
| if (headerSize < 62 || headerSize > 66) { | ||
| throw Exception("Invalid header size: $headerSize (expected 62-66 bytes)") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tighten header size validation to exact 62/66 bytes.
The comment says only 62 or 66 are valid, but the current check allows 63–65 which can mask corrupted headers. Consider enforcing exact values.
🔧 Proposed fix
- if (headerSize < 62 || headerSize > 66) {
- throw Exception("Invalid header size: $headerSize (expected 62-66 bytes)")
- }
+ if (headerSize != 62 && headerSize != 66) {
+ throw Exception("Invalid header size: $headerSize (expected 62 or 66 bytes)")
+ }🤖 Prompt for AI Agents
In `@app/src/main/java/app/gamenative/service/epic/EpicDownloadManager.kt` around
lines 684 - 688, The header size validation in EpicDownloadManager (variable
headerSize) currently allows any value between 62 and 66, but only exact sizes
62 or 66 are valid; update the check to enforce (headerSize == 62 || headerSize
== 66) and throw an Exception when not one of those exact values, and adjust the
exception message to state "Invalid header size: X (expected 62 or 66 bytes)" to
make the constraint explicit; locate and modify the validation block around
headerSize in EpicDownloadManager.kt.
Overview:
This fixes the parsing issue of a small number of games not downloading correctly.
Technical Details:
There are two versions of the header: V2 and v3.
V2 uses 62 bytes and V3 uses 66 Bytes.
We were only considering the 66 byte-length headers and it was failing.
Now appropriately checks the version and checks the header as expected.
Summary by CodeRabbit
Release Notes