Fix for bug #3500861 did not work properly, fixed the fix by applying
the setContext() call only to the root parser. Also added a make target to run the benchmark - it relies on the testdata module being present at the same location as in the repository.
This commit is contained in:
parent
fefcce65be
commit
b46cee3884
@ -169,6 +169,13 @@ tests/runtestspp.@OBJEXT@: tests/runtestspp.cpp tests/runtests.c tests/chardata.
|
||||
tests/runtestspp: tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY)
|
||||
$(LINK_CXX_EXE) tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY)
|
||||
|
||||
tests/benchmark/benchmark.@OBJEXT@: tests/benchmark/benchmark.c
|
||||
tests/benchmark/benchmark: tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY)
|
||||
$(LINK_EXE) tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY)
|
||||
|
||||
run-benchmark: tests/benchmark/benchmark
|
||||
tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3
|
||||
|
||||
tests/xmlts.zip:
|
||||
wget --output-document=tests/xmlts.zip \
|
||||
http://www.w3.org/XML/Test/xmlts20020606.zip
|
||||
|
@ -433,7 +433,7 @@ getElementType(XML_Parser parser, const ENCODING *enc,
|
||||
const char *ptr, const char *end);
|
||||
|
||||
static unsigned long generate_hash_secret_salt(void);
|
||||
static XML_Bool parsingSetup(XML_Parser parser);
|
||||
static XML_Bool startParsing(XML_Parser parser);
|
||||
|
||||
static XML_Parser
|
||||
parserCreate(const XML_Char *encodingName,
|
||||
@ -698,13 +698,13 @@ generate_hash_secret_salt(void)
|
||||
return rand();
|
||||
}
|
||||
|
||||
static XML_Bool
|
||||
parsingSetup(XML_Parser parser)
|
||||
static XML_Bool /* only valid for root parser */
|
||||
startParsing(XML_Parser parser)
|
||||
{
|
||||
/* hash functions must be initialized before setContext() is called */
|
||||
if (hash_secret_salt == 0)
|
||||
hash_secret_salt = generate_hash_secret_salt();
|
||||
if (parser != NULL && ns) {
|
||||
if (ns) {
|
||||
/* implicit context only set for root parser, since child
|
||||
parsers (i.e. external entity parsers) will inherit it
|
||||
*/
|
||||
@ -1507,7 +1507,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
|
||||
errorCode = XML_ERROR_FINISHED;
|
||||
return XML_STATUS_ERROR;
|
||||
case XML_INITIALIZED:
|
||||
if (!parsingSetup(parser)) {
|
||||
if (parentParser == NULL && !startParsing(parser)) {
|
||||
errorCode = XML_ERROR_NO_MEMORY;
|
||||
return XML_STATUS_ERROR;
|
||||
}
|
||||
@ -1633,7 +1633,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
|
||||
errorCode = XML_ERROR_FINISHED;
|
||||
return XML_STATUS_ERROR;
|
||||
case XML_INITIALIZED:
|
||||
if (!parsingSetup(parser)) {
|
||||
if (parentParser == NULL && !startParsing(parser)) {
|
||||
errorCode = XML_ERROR_NO_MEMORY;
|
||||
return XML_STATUS_ERROR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user