When serializing pack files for being packed in the resulting installer, we're writing the size of the original file to the pack stream for being able to get the size of bytes to read back later from the pack stream during installing. This has two inconveniences:
There is just written the size of the original file. This size might change when compressing it before serializing, so we can't really compress a packed file using an additional compressor stream.
Generally, the size is written to the pack stream itself before the file is serialized to the same stream, so if the serialized size changes after filtering or compression the unpacker doesn't notice this change and we can't change this size later after serializing, thus, the unpacker would receive the wrong number of bytes to deserialize.
Change the above drawbacks in this way:
Remove writing the size before serializing and replace this by writing the serialized pack data size after serializing, getting the number of written bytes from the final serializer stream.
I can reproduce this now with your example, thanks. I'll have a look at this.
I believe I have a fix. The code you referred to is the right one.
The wrong line is
and should be:
because PackFile.size() is the compressed size of the file, but PackFile.length() is the uncompressed size, which should apply here while uncompressing it to the target file.
Thanks for the hint.
After a few more tests I will push this to 5.1.0-RC5.
Good news! Thank you very much!