diff options
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69229-1.patch')
| -rw-r--r-- | meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69229-1.patch | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69229-1.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69229-1.patch new file mode 100644 index 0000000000..70feb03258 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69229-1.patch | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | From 9e03b5732805f3cf3c5c249761e2fb8ace2223d3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 3 | Date: Sat, 3 Jan 2026 03:57:17 +0000 | ||
| 4 | Subject: [PATCH 1/2] Use collections.deque for chunk splits (#11892) (#11912) | ||
| 5 | |||
| 6 | From: Sam Bull <git@sambull.org> | ||
| 7 | |||
| 8 | (cherry picked from commit 271532ea355c65480c8ecc14137dfbb72aec8f6f) | ||
| 9 | |||
| 10 | --------- | ||
| 11 | |||
| 12 | Co-authored-by: Finder <nakamurajames123@gmail.com> | ||
| 13 | |||
| 14 | CVE: CVE-2025-69229 | ||
| 15 | Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/dc3170b56904bdf814228fae70a5501a42a6c712] | ||
| 16 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 17 | --- | ||
| 18 | aiohttp/streams.py | 8 ++++---- | ||
| 19 | tests/test_http_parser.py | 14 +++++++++----- | ||
| 20 | 2 files changed, 13 insertions(+), 9 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/aiohttp/streams.py b/aiohttp/streams.py | ||
| 23 | index 7a3f64d..108257e 100644 | ||
| 24 | --- a/aiohttp/streams.py | ||
| 25 | +++ b/aiohttp/streams.py | ||
| 26 | @@ -148,7 +148,7 @@ class StreamReader(AsyncStreamReaderMixin): | ||
| 27 | self._loop = loop | ||
| 28 | self._size = 0 | ||
| 29 | self._cursor = 0 | ||
| 30 | - self._http_chunk_splits: Optional[List[int]] = None | ||
| 31 | + self._http_chunk_splits: Optional[Deque[int]] = None | ||
| 32 | self._buffer: Deque[bytes] = collections.deque() | ||
| 33 | self._buffer_offset = 0 | ||
| 34 | self._eof = False | ||
| 35 | @@ -295,7 +295,7 @@ class StreamReader(AsyncStreamReaderMixin): | ||
| 36 | raise RuntimeError( | ||
| 37 | "Called begin_http_chunk_receiving when some data was already fed" | ||
| 38 | ) | ||
| 39 | - self._http_chunk_splits = [] | ||
| 40 | + self._http_chunk_splits = collections.deque() | ||
| 41 | |||
| 42 | def end_http_chunk_receiving(self) -> None: | ||
| 43 | if self._http_chunk_splits is None: | ||
| 44 | @@ -454,7 +454,7 @@ class StreamReader(AsyncStreamReaderMixin): | ||
| 45 | raise self._exception | ||
| 46 | |||
| 47 | while self._http_chunk_splits: | ||
| 48 | - pos = self._http_chunk_splits.pop(0) | ||
| 49 | + pos = self._http_chunk_splits.popleft() | ||
| 50 | if pos == self._cursor: | ||
| 51 | return (b"", True) | ||
| 52 | if pos > self._cursor: | ||
| 53 | @@ -527,7 +527,7 @@ class StreamReader(AsyncStreamReaderMixin): | ||
| 54 | chunk_splits = self._http_chunk_splits | ||
| 55 | # Prevent memory leak: drop useless chunk splits | ||
| 56 | while chunk_splits and chunk_splits[0] < self._cursor: | ||
| 57 | - chunk_splits.pop(0) | ||
| 58 | + chunk_splits.popleft() | ||
| 59 | |||
| 60 | if self._size < self._low_water and self._protocol._reading_paused: | ||
| 61 | self._protocol.resume_reading() | ||
| 62 | diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py | ||
| 63 | index d4c1768..b9d917f 100644 | ||
| 64 | --- a/tests/test_http_parser.py | ||
| 65 | +++ b/tests/test_http_parser.py | ||
| 66 | @@ -1223,7 +1223,8 @@ def test_http_request_chunked_payload(parser) -> None: | ||
| 67 | parser.feed_data(b"4\r\ndata\r\n4\r\nline\r\n0\r\n\r\n") | ||
| 68 | |||
| 69 | assert b"dataline" == b"".join(d for d in payload._buffer) | ||
| 70 | - assert [4, 8] == payload._http_chunk_splits | ||
| 71 | + assert payload._http_chunk_splits is not None | ||
| 72 | + assert [4, 8] == list(payload._http_chunk_splits) | ||
| 73 | assert payload.is_eof() | ||
| 74 | |||
| 75 | |||
| 76 | @@ -1238,7 +1239,8 @@ def test_http_request_chunked_payload_and_next_message(parser) -> None: | ||
| 77 | ) | ||
| 78 | |||
| 79 | assert b"dataline" == b"".join(d for d in payload._buffer) | ||
| 80 | - assert [4, 8] == payload._http_chunk_splits | ||
| 81 | + assert payload._http_chunk_splits is not None | ||
| 82 | + assert [4, 8] == list(payload._http_chunk_splits) | ||
| 83 | assert payload.is_eof() | ||
| 84 | |||
| 85 | assert len(messages) == 1 | ||
| 86 | @@ -1262,12 +1264,13 @@ def test_http_request_chunked_payload_chunks(parser) -> None: | ||
| 87 | parser.feed_data(b"test: test\r\n") | ||
| 88 | |||
| 89 | assert b"dataline" == b"".join(d for d in payload._buffer) | ||
| 90 | - assert [4, 8] == payload._http_chunk_splits | ||
| 91 | + assert payload._http_chunk_splits is not None | ||
| 92 | + assert [4, 8] == list(payload._http_chunk_splits) | ||
| 93 | assert not payload.is_eof() | ||
| 94 | |||
| 95 | parser.feed_data(b"\r\n") | ||
| 96 | assert b"dataline" == b"".join(d for d in payload._buffer) | ||
| 97 | - assert [4, 8] == payload._http_chunk_splits | ||
| 98 | + assert [4, 8] == list(payload._http_chunk_splits) | ||
| 99 | assert payload.is_eof() | ||
| 100 | |||
| 101 | |||
| 102 | @@ -1278,7 +1281,8 @@ def test_parse_chunked_payload_chunk_extension(parser) -> None: | ||
| 103 | parser.feed_data(b"4;test\r\ndata\r\n4\r\nline\r\n0\r\ntest: test\r\n\r\n") | ||
| 104 | |||
| 105 | assert b"dataline" == b"".join(d for d in payload._buffer) | ||
| 106 | - assert [4, 8] == payload._http_chunk_splits | ||
| 107 | + assert payload._http_chunk_splits is not None | ||
| 108 | + assert [4, 8] == list(payload._http_chunk_splits) | ||
| 109 | assert payload.is_eof() | ||
| 110 | |||
| 111 | |||
