Hi, Here is my additional observation.
> > Reproduce the problem on liblzma > ---------------------------------------- when setting filter as only LZMA1, it returns expected SIZE of output. Because BCJ should not change size, BCJ may have a bug, or LZMA1 - BCJ pipeline may be a problem. test_lzma_bcj_exact_size.c ``` /* please placed in xz/tests/ */ #include "tests.h" static uint8_t buf[12800]; static uint8_t obuf[12800]; static void decompress(size_t in_size) { lzma_ret lzret; const size_t out_size = 12800; lzma_stream strm = LZMA_STREAM_INIT; strm.next_in = buf; strm.avail_in = in_size; strm.next_out = obuf; strm.avail_out = out_size; lzma_options_lzma opt_lzma; succeed(lzma_lzma_preset(&opt_lzma, 0)); lzma_filter filters[3] = { // { .id = LZMA_FILTER_X86, .options = NULL }, { .id = LZMA_FILTER_LZMA1, .options = &opt_lzma }, { .id = LZMA_VLI_UNKNOWN, .options = NULL }, }; succeed(lzma_raw_decoder(&strm, filters)); lzret = lzma_code(&strm, LZMA_RUN); expect(lzret == LZMA_OK); expect(strm.total_in == in_size); expect(strm.total_out == out_size); // LZMA1+BCJ returns 12796 bytes, LZMA1 returns 12800 bytes } extern int main(void) { FILE * filp = fopen("lzmabcj.bin", "rb"); int in_size = fread(buf, sizeof(uint8_t), 11327, filp); // payload == 11327 bytes decompress(in_size); return 0; } ``` > Download links > ------------------ > > you can download a test data from > https://github.com/miurahr/py7zr/files/4872155/lzmabcj.bin.gz Hiroshi