diff --git a/CVE-2025-6069-quad-complex-HTMLParser.patch b/CVE-2025-6069-quad-complex-HTMLParser.patch
new file mode 100644
index 0000000..70eb744
--- /dev/null
+++ b/CVE-2025-6069-quad-complex-HTMLParser.patch
@@ -0,0 +1,237 @@
+From 1d53c3e7343bddb064182e02c21b13be9b63390f Mon Sep 17 00:00:00 2001
+From: Serhiy Storchaka
+Date: Fri, 13 Jun 2025 19:57:48 +0300
+Subject: [PATCH] [3.12] gh-135462: Fix quadratic complexity in processing
+ special input in HTMLParser (GH-135464)
+
+End-of-file errors are now handled according to the HTML5 specs --
+comments and declarations are automatically closed, tags are ignored.
+(cherry picked from commit 6eb6c5dbfb528bd07d77b60fd71fd05d81d45c41)
+
+Co-authored-by: Serhiy Storchaka
+---
+ Lib/html/parser.py | 41 +++-
+ Lib/test/test_htmlparser.py | 94 ++++++++--
+ Misc/NEWS.d/next/Security/2025-06-13-15-55-22.gh-issue-135462.KBeJpc.rst | 4
+ 3 files changed, 116 insertions(+), 23 deletions(-)
+ create mode 100644 Misc/NEWS.d/next/Security/2025-06-13-15-55-22.gh-issue-135462.KBeJpc.rst
+
+Index: Python-3.12.11/Lib/html/parser.py
+===================================================================
+--- Python-3.12.11.orig/Lib/html/parser.py 2025-07-02 17:09:00.904899297 +0200
++++ Python-3.12.11/Lib/html/parser.py 2025-07-02 17:09:12.496469955 +0200
+@@ -25,6 +25,7 @@
+ charref = re.compile('(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]')
+
+ starttagopen = re.compile('<[a-zA-Z]')
++endtagopen = re.compile('[a-zA-Z]')
+ piclose = re.compile('>')
+ commentclose = re.compile(r'--\s*>')
+ # Note:
+@@ -177,7 +178,7 @@
+ k = self.parse_pi(i)
+ elif startswith("', i + 1)
+- if k < 0:
+- k = rawdata.find('<', i + 1)
+- if k < 0:
+- k = i + 1
++ if starttagopen.match(rawdata, i): # < + letter
++ pass
++ elif startswith("", i):
++ if i + 2 == n:
++ self.handle_data("")
++ elif endtagopen.match(rawdata, i): # + letter
++ pass
++ else:
++ # bogus comment
++ self.handle_comment(rawdata[i+2:])
++ elif startswith("', [('comment', '-!>')]),
++ (''
+ ''
+ ''
+ '')
+ expected = [
++ ('comment', 'ELEMENT br EMPTY'),
+ ('comment', ' not really a comment '),
+ ('comment', ' not a comment either --'),
+ ('comment', ' -- close enough --'),
+@@ -600,6 +650,26 @@
+ ('endtag', 'a'), ('data', ' bar & baz')]
+ )
+
++ @support.requires_resource('cpu')
++ def test_eof_no_quadratic_complexity(self):
++ # Each of these examples used to take about an hour.
++ # Now they take a fraction of a second.
++ def check(source):
++ parser = html.parser.HTMLParser()
++ parser.feed(source)
++ parser.close()
++ n = 120_000
++ check("
+
+- Add CVE-2025-6069-quad-complex-HTMLParser.patch to avoid worst
+ case quadratic complexity when processing certain crafted
+ malformed inputs with HTMLParser (CVE-2025-6069, bsc#1244705).
+
-------------------------------------------------------------------
Wed Jul 2 13:14:28 UTC 2025 - Matej Cepl
diff --git a/python312.spec b/python312.spec
index 4840035..5caacd0 100644
--- a/python312.spec
+++ b/python312.spec
@@ -187,6 +187,9 @@ Patch44: doc-py38-to-py36.patch
# PATCH-FIX-UPSTREAM bsc1243155-sphinx-non-determinism.patch bsc#1243155 mcepl@suse.com
# Doc: Generate ids for audit_events using docname
Patch45: bsc1243155-sphinx-non-determinism.patch
+# PATCH-FIX-UPSTREAM CVE-2025-6069-quad-complex-HTMLParser.patch bsc#1244705 mcepl@suse.com
+# avoid quadratic complexity when processing malformed inputs with HTMLParser
+Patch46: CVE-2025-6069-quad-complex-HTMLParser.patch
BuildRequires: autoconf-archive
BuildRequires: automake
BuildRequires: fdupes