A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/python/cpython/commit/18b20bad75b4ff0486940fba4ec680e96e70f3a2 below:

Use XML_SetHashSalt in _elementtree (GH-9146) (GH-9394) · python/cpython@18b20ba · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+15

-1

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+15

-1

lines changed Original file line number Diff line number Diff line change

@@ -3,7 +3,7 @@

3 3 4 4

/* note: you must import expat.h before importing this module! */

5 5 6 -

#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0"

6 +

#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.1"

7 7

#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"

8 8 9 9

struct PyExpat_CAPI

@@ -43,6 +43,8 @@ struct PyExpat_CAPI

43 43

XML_Parser parser, XML_UnknownEncodingHandler handler,

44 44

void *encodingHandlerData);

45 45

void (*SetUserData)(XML_Parser parser, void *userData);

46 +

/* might be none for expat < 2.1.0 */

47 +

int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt);

46 48

/* always add new stuff to the end! */

47 49

};

48 50 Original file line number Diff line number Diff line change

@@ -0,0 +1,2 @@

1 +

The C accelerated _elementtree module now initializes hash randomization

2 +

salt from _Py_HashSecret instead of libexpat's default CSPRNG.

Original file line number Diff line number Diff line change

@@ -2574,6 +2574,11 @@ xmlparser(PyObject* self_, PyObject* args, PyObject* kw)

2574 2574

PyErr_NoMemory();

2575 2575

return NULL;

2576 2576

}

2577 +

/* expat < 2.1.0 has no XML_SetHashSalt() */

2578 +

if (EXPAT(SetHashSalt) != NULL) {

2579 +

EXPAT(SetHashSalt)(self->parser,

2580 +

(unsigned long)_Py_HashSecret.prefix);

2581 +

}

2577 2582 2578 2583

ALLOC(sizeof(XMLParserObject), "create expatparser");

2579 2584 Original file line number Diff line number Diff line change

@@ -2042,6 +2042,11 @@ MODULE_INITFUNC(void)

2042 2042

capi.SetProcessingInstructionHandler = XML_SetProcessingInstructionHandler;

2043 2043

capi.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler;

2044 2044

capi.SetUserData = XML_SetUserData;

2045 +

#if XML_COMBINED_VERSION >= 20100

2046 +

capi.SetHashSalt = XML_SetHashSalt;

2047 +

#else

2048 +

capi.SetHashSalt = NULL;

2049 +

#endif

2045 2050 2046 2051

/* export using capsule */

2047 2052

capi_object = PyCapsule_New(&capi, PyExpat_CAPSULE_NAME, NULL);

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4