From 8f733c1262813eac42a511faa0e1a789d8063277 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 26 Jun 2025 16:30:48 +1200 Subject: [PATCH] pytests: test normalise_int32 against out-of-range numbers For example, we don't want to "normalise" 0x9876543210 to 0x9776543210, or 0x200000000 to 0x100000000. That is just causing random damage to 64 bit values without achieving the sign switch. Signed-off-by: Douglas Bagnall Reviewed-by: Gary Lockyer --- python/samba/tests/common.py | 3 +++ selftest/knownfail.d/python-common | 1 + 2 files changed, 4 insertions(+) create mode 100644 selftest/knownfail.d/python-common diff --git a/python/samba/tests/common.py b/python/samba/tests/common.py index a181fb70056..c767d2522f7 100644 --- a/python/samba/tests/common.py +++ b/python/samba/tests/common.py @@ -29,3 +29,6 @@ class CommonTests(samba.tests.TestCase): self.assertEqual('17', normalise_int32('17')) self.assertEqual('-123', normalise_int32('-123')) self.assertEqual('-1294967296', normalise_int32('3000000000')) + self.assertRaises(ValueError, normalise_int32, 1 << 32) + self.assertRaises(ValueError, normalise_int32, 12345678901234567890) + self.assertRaises(ValueError, normalise_int32, -1000000000000) diff --git a/selftest/knownfail.d/python-common b/selftest/knownfail.d/python-common new file mode 100644 index 00000000000..3d73084472d --- /dev/null +++ b/selftest/knownfail.d/python-common @@ -0,0 +1 @@ +samba.tests.common.samba.tests.common.CommonTests.test_normalise_int32 -- 2.47.2