Repository navigation
fix: P3D and PBO reads of garbage data - #47
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Obfuscated PBOs carry decoy files: a valid ODOL header followed by garbage. Reading them panicked or aborted the process on allocations of up to 17 GB. Now they fail with an error. - core::decompress_lzo: LZO1X decompression with bounds checks, replacing lzokay_native::decompress for ODOL arrays. Its output only grows as input is read and stops at the expected size. lzokay panicked on matches reaching before the start of the output and allocated the expected size up front. Gives the same bytes and end position as lzokay for every LZO block of Arma 3 and ~28,000 mod models. - decompress_lzss, raw ODOL array reads and array capacities grow with the data instead of trusting the count. Default-filled condensed arrays are capped at 2^24 elements (the largest LOD seen has 669,004 vertices). Element count times size is checked for overflow. - AnimationRTWeight: more than 4 bone weights is an error, it indexed past its 8 bytes. - PBO entries: compressed data with bytes after the LZSS stream is kept as stored, like other undecodable entries, instead of panicking. - Tests: corrupted and truncated test models, a PBO with garbage compressed entries.
lzokay-native 0.2 has bounded decompression that returns errors instead of panicking, so the crate's own LZO1X decoder is no longer needed. - ODOL arrays: lzokay_native::decompress_bounded with the expected size. core::decompress_lzo and LzoError are removed. - PAA mipmaps (DXT1, DXT5): decompress_all_bounded, limited to the mipmap's 4x4 blocks (8 bytes each for DXT1, 16 for DXT5). Garbage mipmaps panicked or decoded to more data than the texture holds. - Requires 0.2.1: 0.2.0 made ODOL::from_path 15-30% slower. Arma 3 and ~28,000 mod models and ~320,000 mod textures read the same as before, with the same mipmap bytes. 442 decoy textures that panicked and 14 that decoded to oversized garbage now fail with an error.
TheWillard
force-pushed
the
fix/p3d-garbage-input
branch
from
November 6, 2026 20:24
d78ac9c to
c0edc09
Compare
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.
Obfuscated PBOs carry decoy files: a valid ODOL or PAA header followed by garbage. Reading them panicked or aborted the process on allocations of up to 17 GB. Now they fail with an error.
decompress_boundedwith the expected size, PAA mipmaps (DXT1, DXT5)decompress_all_bounded, limited to the mipmap's 4x4 blocks (8 bytes each for DXT1, 16 for DXT5). lzokay 0.1 panicked on matches reaching before the start of the output and allocated the expected size up front.decompress_lzss, raw ODOL array reads and array capacities grow with the data instead of trusting the count. Default-filled condensed arrays are capped at 2^24 elements (the largest LOD seen has 669,004 vertices). Element count times size is checked for overflow.AnimationRTWeight: more than 4 bone weights is an error, it indexed past its 8 bytes.mainwith the lzokay panic), a PBO with garbage compressed entries (fails onmainat theassert_eq!).Checked against Arma 3 (6,682 models, 20,817 textures) and 150 mods (~28,000 models, ~320,000 textures):
ODOL::from_pathis as fast as before.Independent of #46.