mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-122854: Add Py_HashBuffer() function (#122855)
This commit is contained in:
parent
3d60dfbe17
commit
d8e69b2c1b
17 changed files with 80 additions and 25 deletions
|
@ -15,7 +15,6 @@
|
|||
#endif
|
||||
|
||||
#include <Python.h>
|
||||
#include "pycore_pyhash.h" // _Py_HashBytes()
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
|
@ -45,7 +44,7 @@ static int fuzz_builtin_int(const char* data, size_t size) {
|
|||
/* Pick a random valid base. (When the fuzzed function takes extra
|
||||
parameters, it's somewhat normal to hash the input to generate those
|
||||
parameters. We want to exercise all code paths, so we do so here.) */
|
||||
int base = _Py_HashBytes(data, size) % 37;
|
||||
int base = Py_HashBuffer(data, size) % 37;
|
||||
if (base == 1) {
|
||||
// 1 is the only number between 0 and 36 that is not a valid base.
|
||||
base = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue