diff --git a/CVE-2025-4516-DecodeError-handler.patch b/CVE-2025-4516-DecodeError-handler.patch index eddadf0..7ac0e30 100644 --- a/CVE-2025-4516-DecodeError-handler.patch +++ b/CVE-2025-4516-DecodeError-handler.patch @@ -20,8 +20,8 @@ with _PyUnicode_DecodeUnicodeEscapeInternal(). Misc/NEWS.d/next/Security/2025-05-09-20-22-54.gh-issue-133767.kN2i3Q.rst | 2 Objects/bytesobject.c | 43 ++++---- Objects/unicodeobject.c | 46 +++++--- - Parser/string_parser.c | 28 +++-- - 8 files changed, 173 insertions(+), 58 deletions(-) + Parser/string_parser.c | 32 +++--- + 8 files changed, 175 insertions(+), 60 deletions(-) Index: Python-3.12.10/Include/internal/pycore_bytesobject.h =================================================================== @@ -133,7 +133,7 @@ Index: Python-3.12.10/Lib/test/test_codeccallbacks.py Index: Python-3.12.10/Lib/test/test_codecs.py =================================================================== --- Python-3.12.10.orig/Lib/test/test_codecs.py 2025-05-17 12:00:00.357214034 +0000 -+++ Python-3.12.10/Lib/test/test_codecs.py 2025-05-17 17:39:19.493026974 +0000 ++++ Python-3.12.10/Lib/test/test_codecs.py 2025-05-17 21:37:06.990511438 +0000 @@ -1196,23 +1196,39 @@ check(br"[\1010]", b"[A0]") check(br"[\x41]", b"[A]") @@ -147,7 +147,7 @@ Index: Python-3.12.10/Lib/test/test_codecs.py if b not in b'abfnrtvx': - with self.assertWarns(DeprecationWarning): + with self.assertWarnsRegex(DeprecationWarning, -+ r'"\\%c" is an invalid escape sequence' % i): ++ r"'\\%c' is an invalid escape sequence" % i): check(b"\\" + b, b"\\" + b) - with self.assertWarns(DeprecationWarning): + with self.assertWarnsRegex(DeprecationWarning, @@ -430,7 +430,7 @@ Index: Python-3.12.10/Objects/unicodeobject.c Index: Python-3.12.10/Parser/string_parser.c =================================================================== --- Python-3.12.10.orig/Parser/string_parser.c 2025-04-08 11:35:47.000000000 +0000 -+++ Python-3.12.10/Parser/string_parser.c 2025-05-17 12:27:43.308776801 +0000 ++++ Python-3.12.10/Parser/string_parser.c 2025-05-17 21:41:25.941179624 +0000 @@ -1,4 +1,6 @@ #include +#include "pycore_bytesobject.h" // _PyBytes_DecodeEscape() @@ -438,6 +438,18 @@ Index: Python-3.12.10/Parser/string_parser.c #include "tokenizer.h" #include "pegen.h" +@@ -25,9 +27,9 @@ + int octal = ('4' <= c && c <= '7'); + PyObject *msg = + octal +- ? PyUnicode_FromFormat("invalid octal escape sequence '\\%.3s'", ++ ? PyUnicode_FromFormat("'\\%.3s' is an invalid octal escape sequence. ", + first_invalid_escape) +- : PyUnicode_FromFormat("invalid escape sequence '\\%c'", c); ++ : PyUnicode_FromFormat("'\\%c' is an invalid escape sequence. ", c); + if (msg == NULL) { + return -1; + } @@ -181,15 +183,18 @@ len = p - buf; s = buf;