Skip to content

fix(android): Add missing Android binary chunk types and improve parsing robustness#626

Merged
runningcode merged 1 commit into
mainfrom
seer/fix-android-chunk-types
May 21, 2026
Merged

fix(android): Add missing Android binary chunk types and improve parsing robustness#626
runningcode merged 1 commit into
mainfrom
seer/fix-android-chunk-types

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry Bot commented May 21, 2026

This PR addresses a ValueError: 516 is not a valid ChunkType that occurred when parsing Android APKs containing newer resource table chunk types.

Changes Made:

  • Updated ChunkType enum: Added TABLE_OVERLAYABLE = 0x0204, TABLE_OVERLAYABLE_POLICY = 0x0205, and TABLE_STAGED_ALIAS = 0x0206 to src/launchpad/parsers/android/binary/types.py. These chunk types were introduced in Android 10+ and were previously missing, causing parsing failures.
  • Improved read_chunk_header robustness: Modified read_chunk_header() in src/launchpad/parsers/android/binary/android_binary_parser.py to gracefully handle unknown chunk_type values. Instead of raising a ValueError when an unrecognized integer is encountered, it now stores the raw integer value. This allows the parser to continue processing, with read_package()'s existing fallback logic to skip unknown chunks.
  • Updated ChunkHeader type hint: Changed the type annotation for ChunkHeader.chunk_type to Union[ChunkType, int] in src/launchpad/parsers/android/binary/types.py to reflect that it can now hold either a known ChunkType enum member or an unknown integer value.

Why these changes:
The previous implementation of the Android binary parser's ChunkType enum was incomplete, leading to crashes when processing APKs that included newer Android resource table formats. Specifically, the ValueError was triggered by 0x0204 (TABLE_OVERLAYABLE). These changes ensure that the parser can correctly identify and process known modern chunk types, and gracefully skip any future unknown chunk types without crashing, improving the overall robustness and forward compatibility of the Android artifact processing.

Fixes LAUNCHPAD-7P

@sentry
Copy link
Copy Markdown
Contributor Author

sentry Bot commented May 21, 2026

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
HackerNews com.emergetools.hackernews 3.8 (1) Release

Android

🔗 App Name App ID Version Configuration
Hacker News com.emergetools.hackernews 1.0.2 (13) Release

⚙️ launchpad-test-android Build Distribution Settings

@chromy chromy marked this pull request as ready for review May 21, 2026 10:56
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a14cd7e. Configure here.

return ChunkHeader(
start_offset=start_offset,
chunk_type=ChunkType(chunk_type),
chunk_type=parsed_chunk_type,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unknown chunk types still crash in parse_resource_table

Medium Severity

The read_chunk_header change now allows unknown chunk type integers to pass through instead of crashing, but parse_resource_table still raises a ValueError in its else branch for any chunk type that isn't STRING_POOL, TABLE_PACKAGE, or NULL. Before this PR, unknown types would crash earlier in read_chunk_header; now they flow through and crash at line 560 instead. Both parse_xml and read_package gracefully skip unknown chunks, but parse_resource_table does not, creating an inconsistency that undermines the forward-compatibility goal.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a14cd7e. Configure here.

Copy link
Copy Markdown
Contributor

@runningcode runningcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@runningcode runningcode merged commit cd89559 into main May 21, 2026
25 checks passed
@runningcode runningcode deleted the seer/fix-android-chunk-types branch May 21, 2026 14:16
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