new file mode 100644
@@ -0,0 +1,176 @@
+From 9dd8eaf4e31f1237ef2c1574a8c82a739fca5805 Mon Sep 17 00:00:00 2001
+From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com>
+Date: Wed, 9 Sep 2026 14:43:30 +0100
+Subject: [PATCH] [PR #13677/9e08ba02 backport][3.14] Fix cookie overflow
+ (#13679)
+
+**This is a backport of PR #13677 as merged into master
+(9e08ba02abe573ce9e4cc541d4e3c3646adb43a7).**
+
+---------
+
+Co-authored-by: Sam Bull <git@sambull.org>
+
+CVE: CVE-2026-111065
+Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/9dd8eaf4e31f1237ef2c1574a8c82a739fca5805]
+
+Backport Changes:
+- Use the existing Optional type spelling for the response variable.
+- Add Sequence to the existing typing imports for the regression test.
+
+Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com>
+---
+ CHANGES/13677.bugfix.rst | 1 +
+ aiohttp/client.py | 5 ++++
+ aiohttp/cookiejar.py | 10 +++++++-
+ tests/test_client_functional.py | 45 +++++++++++++++++++++++++++++++++
+ tests/test_cookiejar.py | 22 ++++++++++++++++
+ 5 files changed, 82 insertions(+), 1 deletion(-)
+ create mode 100644 CHANGES/13677.bugfix.rst
+
+diff --git a/CHANGES/13677.bugfix.rst b/CHANGES/13677.bugfix.rst
+new file mode 100644
+index 0000000..bea67cb
+--- /dev/null
++++ b/CHANGES/13677.bugfix.rst
+@@ -0,0 +1 @@
++Fixed a possible ``OverflowError`` on cookies and a connection not being closed properly -- by :user:`Dreamsorcerer`.
+diff --git a/aiohttp/client.py b/aiohttp/client.py
+index 8cd9add..f404b55 100644
+--- a/aiohttp/client.py
++++ b/aiohttp/client.py
+@@ -628,6 +628,7 @@ class ClientSession:
+ await trace.send_request_start(method, url.update_query(params), headers)
+
+ timer = tm.timer()
++ resp: Optional[ClientResponse] = None
+ try:
+ with timer:
+ # https://www.rfc-editor.org/rfc/rfc9112.html#name-retrying-requests
+@@ -939,6 +940,10 @@ class ClientSession:
+ handle.cancel()
+ handle = None
+
++ if resp is not None:
++ # A failure occurred after the response was received.
++ resp.close()
++
+ for trace in traces:
+ await trace.send_request_exception(
+ method, url.update_query(params), headers, e
+diff --git a/aiohttp/cookiejar.py b/aiohttp/cookiejar.py
+index c5e5b09..6712b90 100644
+--- a/aiohttp/cookiejar.py
++++ b/aiohttp/cookiejar.py
+@@ -410,7 +410,15 @@ class CookieJar(AbstractCookieJar):
+ if max_age := cookie["max-age"]:
+ try:
+ delta_seconds = int(max_age)
+- max_age_expiration = min(time.time() + delta_seconds, self.MAX_TIME)
++ # https://datatracker.ietf.org/doc/html/rfc6265#section-5.2.2
++ if delta_seconds <= 0:
++ max_age_expiration = 0.0
++ else:
++ # Cap first to protect against OverflowError on next line.
++ delta_seconds = min(delta_seconds, self.MAX_TIME)
++ max_age_expiration = min(
++ time.time() + delta_seconds, self.MAX_TIME
++ )
+ self._expire_cookie(max_age_expiration, domain, path, name)
+ except ValueError:
+ cookie["max-age"] = ""
+diff --git a/tests/test_client_functional.py b/tests/test_client_functional.py
+index 60caf6e..3415b83 100644
+--- a/tests/test_client_functional.py
++++ b/tests/test_client_functional.py
+@@ -23,6 +23,7 @@ from typing import (
+ List,
+ NoReturn,
+ Optional,
++ Sequence,
+ Type,
+ )
+ from unittest import mock
+@@ -2978,6 +2979,50 @@ async def test_set_cookies_max_age_overflow(aiohttp_client) -> None:
+ assert int(cookie["max-age"]) == int(overflow)
+
+
++async def test_connection_released_when_cookie_processing_fails(
++ aiohttp_client: AiohttpClient,
++) -> None:
++ class EvilJar(aiohttp.CookieJar):
++ def update_cookies_from_headers(
++ self, headers: Sequence[str], response_url: URL
++ ) -> None:
++ raise RuntimeError("boom")
++
++ hold = asyncio.Event()
++
++ async def hostile(request: web.Request) -> web.StreamResponse:
++ ret = web.StreamResponse()
++ ret.content_length = 2
++ ret.set_cookie("sid", "x")
++ await ret.prepare(request)
++ await ret.write(b"x")
++ await hold.wait()
++ assert False
++
++ async def clean(request: web.Request) -> web.Response:
++ return web.Response()
++
++ app = web.Application()
++ app.router.add_get("/hostile", hostile)
++ app.router.add_get("/clean", clean)
++ connector = aiohttp.TCPConnector(limit=1)
++ client = await aiohttp_client(app, connector=connector, cookie_jar=EvilJar())
++
++ try:
++ for _ in range(2):
++ with pytest.raises(RuntimeError, match="boom") as excinfo:
++ await client.get("/hostile")
++ assert not connector._acquired
++ del excinfo
++
++ # The single connector slot is free again: an unaffected request
++ # succeeds instead of waiting forever for a connection.
++ async with client.get("/clean") as resp:
++ assert resp.status == 200
++ finally:
++ hold.set()
++
++
+ async def test_request_conn_error() -> None:
+ client = aiohttp.ClientSession()
+ with pytest.raises(aiohttp.ClientConnectionError):
+diff --git a/tests/test_cookiejar.py b/tests/test_cookiejar.py
+index 5779df9..f3719a7 100644
+--- a/tests/test_cookiejar.py
++++ b/tests/test_cookiejar.py
+@@ -2005,3 +2005,25 @@ async def test_save_load_json_secure_cookies(tmp_path: Path) -> None:
+ assert cookie["secure"] is True
+ assert cookie["httponly"] is True
+ assert cookie["domain"] == "example.com"
++
++
++async def test_update_cookies_max_age_beyond_float_range_is_clamped() -> None:
++ """A hostile Max-Age larger than float max must clamp, not raise OverflowError."""
++ url = URL("https://example.com/")
++ jar = CookieJar()
++
++ jar.update_cookies_from_headers([f"sid=x; Max-Age={'9' * 309}"], url)
++
++ assert "sid" in jar.filter_cookies(url)
++ assert jar._expirations[("example.com", "", "sid")] == CookieJar.MAX_TIME
++
++
++async def test_update_cookies_negative_max_age_beyond_float_range_expires() -> None:
++ """A negative Max-Age below float min must expire the cookie, not raise."""
++ url = URL("https://example.com/")
++ jar = CookieJar()
++
++ jar.update_cookies_from_headers([f"sid=x; Max-Age=-{'9' * 309}"], url)
++
++ assert "sid" not in jar.filter_cookies(url)
++ assert len(jar) == 0
+--
+2.35.6
@@ -26,6 +26,7 @@ SRC_URI += " \
file://CVE-2026-111066_p2.patch \
file://CVE-2026-111750.patch \
file://CVE-2026-111749.patch \
+ file://CVE-2026-111065.patch \
"
CVE_PRODUCT = "aiohttp:aiohttp"