Skip to content

fix: stream string table to prevent OOM on malformed APKs#7

Merged
MiroslavDrbal merged 1 commit intomasterfrom
fix/string-table-oom-v2
Apr 22, 2026
Merged

fix: stream string table to prevent OOM on malformed APKs#7
MiroslavDrbal merged 1 commit intomasterfrom
fix/string-table-oom-v2

Conversation

@RickFromGen
Copy link
Copy Markdown
Collaborator

Replace the old data[]byte + lazy-cache string table with a single-pass streaming decoder that clips strings to a configurable memory budget (default 50 MB). Strings exceeding the budget are truncated longest-first and marked with .

New public API:

  • ParseConfig struct for caller-controlled parser options
  • ParseXmlWithConfig / ParseResourceTableWithConfig
  • ApkParser.Config field
  • DefaultMaxStringTableBytes constant

Existing ParseXml / ParseResourceTable signatures are unchanged.

Replace the old data[]byte + lazy-cache string table with a single-pass
streaming decoder that clips strings to a configurable memory budget
(default 50 MB). Strings exceeding the budget are truncated longest-first
and marked with <TRUNCATED>.

New public API:
- ParseConfig struct for caller-controlled parser options
- ParseXmlWithConfig / ParseResourceTableWithConfig
- ApkParser.Config field
- DefaultMaxStringTableBytes constant

Existing ParseXml / ParseResourceTable signatures are unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MiroslavDrbal MiroslavDrbal merged commit 5f1a84e into master Apr 22, 2026
3 of 7 checks passed
@RickFromGen RickFromGen deleted the fix/string-table-oom-v2 branch April 22, 2026 10:46
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.

2 participants