Skip to content

Conversation

@twiss
Copy link
Member

@twiss twiss commented Nov 26, 2025

Since decompression can increase the memory usage non-linearly, add a config option to limit the decompressed message size.

@twiss twiss requested a review from larabr November 26, 2025 12:25
@twiss twiss force-pushed the max-decompressed-msg-size branch from d5e757c to 8ba8161 Compare November 26, 2025 12:27
@twiss twiss force-pushed the max-decompressed-msg-size branch from 8ba8161 to 6e63ad0 Compare November 26, 2025 12:44
@twiss twiss force-pushed the max-decompressed-msg-size branch 5 times, most recently from 47256ce to 74d4004 Compare November 26, 2025 19:45
@twiss twiss force-pushed the max-decompressed-msg-size branch 3 times, most recently from 37b8c96 to 78d8ea8 Compare December 3, 2025 15:50
@larabr larabr force-pushed the max-decompressed-msg-size branch from 78d8ea8 to 6bfe39f Compare December 5, 2025 13:02
twiss added 3 commits December 5, 2025 14:09
Don't start (de)compressing more data if the (de)compressed data stream
reader hasn't asked for more data yet.

Also, split the input chunks so that we don't overwhelm the output
stream with a lot of data if the input chunks are very large, as
fflate seems to decompress the input chunks completely before
calling `ondata`, which doesn't give us a chance to cancel the
decompression if too much data is provided.
WebKit seems to require this, as it decompresses the entire input chunk
before producing an output chunk, instead of producing output chunks
incrementally.
@twiss twiss force-pushed the max-decompressed-msg-size branch from 6bfe39f to c4be83b Compare December 5, 2025 13:09
Remove internal queue in streams while (de)compressing.
@twiss twiss merged commit a61cf1f into openpgpjs:main Dec 9, 2025
25 of 27 checks passed
@twiss twiss deleted the max-decompressed-msg-size branch December 9, 2025 10:51
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