mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-46913: Fix test_ctypes, test_hashlib, test_faulthandler on UBSan (GH-31675) (GH-31676)
* bpo-46913: Fix test_faulthandler.test_sigfpe() on UBSAN (GH-31662) Disable undefined behavior sanitizer (UBSAN) on faulthandler_sigfpe(). (cherry picked from commit4173d677a1) * bpo-46913: Fix test_faulthandler.test_read_null() on UBSan (GH31672) Disable undefined behavior sanitizer (UBSan) on faulthandler._read_null(). (cherry picked from commit65b92ccdec) * bpo-46913: test_hashlib skips _sha3 tests on UBSan (GH-31673) If Python is built with UBSan, test_hashlib skips tests on the _sha3 extension which currently has undefined behaviors. This change allows to run test_hashlib to check for new UBSan regression, but the known _sha3 undefined behavior must be fixed. (cherry picked from commit6d0d7d2b8c) * bpo-46913: Skip test_ctypes.test_shorts() on UBSan (GH-31674) If Python is built with UBSan, test_ctypes now skips test_shorts(). This change allows to run test_ctypes to check for new UBSan regression, but the known test_shorts() undefined behavior must be fixed. (cherry picked from commitad1b04451d) (cherry picked from commit7b5b429ada)
This commit is contained in:
parent
09819863a3
commit
6a14330318
4 changed files with 43 additions and 12 deletions
|
|
@ -66,7 +66,9 @@ def get_fips_mode():
|
|||
except ImportError:
|
||||
_sha3 = None
|
||||
|
||||
requires_sha3 = unittest.skipUnless(_sha3, 'requires _sha3')
|
||||
# bpo-46913: Don't test the _sha3 extension on a Python UBSAN build
|
||||
SKIP_SHA3 = support.check_sanitizer(ub=True)
|
||||
requires_sha3 = unittest.skipUnless(not SKIP_SHA3 and _sha3, 'requires _sha3')
|
||||
|
||||
|
||||
def hexstr(s):
|
||||
|
|
@ -129,6 +131,8 @@ def __init__(self, *args, **kwargs):
|
|||
|
||||
self.constructors_to_test = {}
|
||||
for algorithm in algorithms:
|
||||
if SKIP_SHA3 and algorithm.startswith('sha3_'):
|
||||
continue
|
||||
self.constructors_to_test[algorithm] = set()
|
||||
|
||||
# For each algorithm, test the direct constructor and the use
|
||||
|
|
@ -181,14 +185,15 @@ def add_builtin_constructor(name):
|
|||
add_builtin_constructor('blake2s')
|
||||
add_builtin_constructor('blake2b')
|
||||
|
||||
_sha3 = self._conditional_import_module('_sha3')
|
||||
if _sha3:
|
||||
add_builtin_constructor('sha3_224')
|
||||
add_builtin_constructor('sha3_256')
|
||||
add_builtin_constructor('sha3_384')
|
||||
add_builtin_constructor('sha3_512')
|
||||
add_builtin_constructor('shake_128')
|
||||
add_builtin_constructor('shake_256')
|
||||
if not SKIP_SHA3:
|
||||
_sha3 = self._conditional_import_module('_sha3')
|
||||
if _sha3:
|
||||
add_builtin_constructor('sha3_224')
|
||||
add_builtin_constructor('sha3_256')
|
||||
add_builtin_constructor('sha3_384')
|
||||
add_builtin_constructor('sha3_512')
|
||||
add_builtin_constructor('shake_128')
|
||||
add_builtin_constructor('shake_256')
|
||||
|
||||
super(HashLibTestCase, self).__init__(*args, **kwargs)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue