mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Qubes: close qrexec stdin and stout
Ensure a server cannon keep the client hannging if more data than necessary is sent. This applies to container and the Qubes implmentation.
This commit is contained in:
parent
874b8865e2
commit
d6bce4dec5
1 changed files with 4 additions and 0 deletions
|
@ -46,6 +46,7 @@ def read_debug_text(p: subprocess.Popen) -> str:
|
||||||
"""Read arbitrarily long text (for debug purposes)"""
|
"""Read arbitrarily long text (for debug purposes)"""
|
||||||
if p.stderr:
|
if p.stderr:
|
||||||
untrusted_text = p.stderr.read(MAX_CONVERSION_LOG_CHARS)
|
untrusted_text = p.stderr.read(MAX_CONVERSION_LOG_CHARS)
|
||||||
|
p.stderr.close()
|
||||||
return untrusted_text.decode("ascii", errors="replace")
|
return untrusted_text.decode("ascii", errors="replace")
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
@ -135,6 +136,9 @@ class Qubes(IsolationProvider):
|
||||||
text = f"Converting page {page}/{n_pages} to pixels"
|
text = f"Converting page {page}/{n_pages} to pixels"
|
||||||
self.print_progress_trusted(document, False, text, percentage)
|
self.print_progress_trusted(document, False, text, percentage)
|
||||||
|
|
||||||
|
# Ensure nothing else is read after all bitmaps are obtained
|
||||||
|
p.stdout.close() # type: ignore [union-attr]
|
||||||
|
|
||||||
# TODO handle leftover code input
|
# TODO handle leftover code input
|
||||||
text = "Converted document to pixels"
|
text = "Converted document to pixels"
|
||||||
self.print_progress_trusted(document, False, text, percentage)
|
self.print_progress_trusted(document, False, text, percentage)
|
||||||
|
|
Loading…
Reference in a new issue