mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Make big endian explicit in int to bytes
Fix issues in older distros that don't yet support python 3.11 where endianness was not a default argument [1]. This is in response to CI failures [2]. [1]: https://docs.python.org/3/library/stdtypes.html#int.to_bytes [2]: https://app.circleci.com/pipelines/github/freedomofpress/dangerzone/2186/workflows/e340ca21-85ce-42b6-9bc3-09e66f96684a/jobs/27380y
This commit is contained in:
parent
5e169a832b
commit
f3032a7142
3 changed files with 3 additions and 3 deletions
|
@ -76,7 +76,7 @@ class DangerzoneConverter:
|
|||
|
||||
@classmethod
|
||||
def _write_int(cls, num: int, file: TextIO = sys.stdout) -> None:
|
||||
cls._write_bytes(num.to_bytes(2, signed=False), file=file)
|
||||
cls._write_bytes(num.to_bytes(2, "big", signed=False), file=file)
|
||||
|
||||
# ==== ASYNC METHODS ====
|
||||
# We run sync methods in async wrappers, because pure async methods are more difficult:
|
||||
|
|
|
@ -36,7 +36,7 @@ def read_int(f: IO[bytes], timeout: float) -> int:
|
|||
untrusted_int = read_bytes(f, 2, timeout)
|
||||
if len(untrusted_int) != 2:
|
||||
raise errors.InterruptedConversionException()
|
||||
return int.from_bytes(untrusted_int, signed=False)
|
||||
return int.from_bytes(untrusted_int, "big", signed=False)
|
||||
|
||||
|
||||
def read_debug_text(f: IO[bytes], size: int) -> str:
|
||||
|
|
|
@ -97,7 +97,7 @@ class Qubes(IsolationProvider):
|
|||
# 1. The size of the Python zipfile, so that the server can know when to
|
||||
# stop.
|
||||
# 2. The Python zipfile itself.
|
||||
bufsize_bytes = len(temp_file.getvalue()).to_bytes(4)
|
||||
bufsize_bytes = len(temp_file.getvalue()).to_bytes(4, "big")
|
||||
wpipe.write(bufsize_bytes)
|
||||
wpipe.write(temp_file.getvalue())
|
||||
|
||||
|
|
Loading…
Reference in a new issue