Skip to content

Disable LZMA encoder timeouts to prevent input loss - #197

Merged
tobiass-threedy merged 1 commit into
boostorg:developfrom
RichardCao:fix-lzma-timeout-input-loss
Nov 13, 2026
Merged

tobiass-threedy merged 1 commit into
boostorg:developfrom
RichardCao:fix-lzma-timeout-input-loss

Conversation

@RichardCao

@RichardCao RichardCao commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #196.

The multithreaded LZMA encoder can return LZMA_OK on its timeout while input remains and output space is available. Returning immediately violates the SymmetricFilter contract and lets symmetric_filter::read() overwrite pending input, producing a valid XZ stream with missing data.

Disable the encoder timeout using a named constant, with a comment explaining the required input/output postcondition. Calls can now wait until input is consumed, output fills, or the encoder finishes. The public interface is unchanged.

Validation:

  • Built and ran all 6 existing LZMA test cases directly with GCC 13.2, C++11, and liblzma 5.4.6: all pass.
  • Rebuilt the implementation with BOOST_IOSTREAMS_LZMA_NO_MULTITHREADED=1: all 6 cases pass.

The full modular Boost build was not run.

@RichardCao RichardCao changed the title Fix LZMA input loss after encoder timeouts Disable LZMA encoder timeouts to prevent input loss Nov 7, 2026
The multithreaded encoder may return LZMA_OK on timeout with input still
pending and output space available. This violates the SymmetricFilter
contract and lets the read path overwrite unconsumed input.

Disable the encoder timeout so each call consumes its input or fills its
output buffer. Give the timeout a named constant to document why it is zero.

Fixes boostorg#196.
@tobiass-threedy
tobiass-threedy force-pushed the fix-lzma-timeout-input-loss branch from 371076f to 62ec0f0 Compare November 13, 2026 10:52
@tobiass-threedy
tobiass-threedy merged commit 27ff4fe into boostorg:develop Nov 13, 2026
@tobiass-threedy

Copy link
Copy Markdown
Collaborator

Thank you for the report!

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.

LZMA input filter can silently discard data after an encoder timeout

2 participants