summaryrefslogtreecommitdiffstats
path: root/Lib/test/pickletester.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2025-06-11 11:01:15 (GMT)
committerGitHub <noreply@github.com>2025-06-11 11:01:15 (GMT)
commit0e969fe8438bc3c98e88e105f9f0e938bb360e47 (patch)
tree254aa3513576ed1129c0305746e5246e2ecc5994 /Lib/test/pickletester.py
parent30494cc72c2b5e0c1d9df5f944fadbb82595497d (diff)
downloadcpython-0e969fe8438bc3c98e88e105f9f0e938bb360e47.zip
cpython-0e969fe8438bc3c98e88e105f9f0e938bb360e47.tar.gz
cpython-0e969fe8438bc3c98e88e105f9f0e938bb360e47.tar.bz2
[3.14] gh-135321: Always raise a correct exception for BINSTRING argument > 0x7fffffff in pickle (GH-135322) (GH-135382)
(cherry picked from commit 2b8b4774d29a707330d463f226630185cbd3ceff) Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/pickletester.py')
-rw-r--r--Lib/test/pickletester.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 9d6ae3e..9a3a26a 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -1100,6 +1100,11 @@ class AbstractUnpickleTests:
self.check_unpickling_error((pickle.UnpicklingError, OverflowError),
dumped)
+ def test_large_binstring(self):
+ errmsg = 'BINSTRING pickle has negative byte count'
+ with self.assertRaisesRegex(pickle.UnpicklingError, errmsg):
+ self.loads(b'T\0\0\0\x80')
+
def test_get(self):
pickled = b'((lp100000\ng100000\nt.'
unpickled = self.loads(pickled)