mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-02-05 05:47:00 +03:00
parser: Allow to set maximum amplification factor
This commit is contained in:
parent
9d80a2b134
commit
ed3bd05284
@ -93,6 +93,7 @@
|
|||||||
<arg choice="plain"><option>--xmlout</option></arg>
|
<arg choice="plain"><option>--xmlout</option></arg>
|
||||||
<arg choice="plain"><option>--push</option></arg>
|
<arg choice="plain"><option>--push</option></arg>
|
||||||
<arg choice="plain"><option>--memory</option></arg>
|
<arg choice="plain"><option>--memory</option></arg>
|
||||||
|
<arg choice="plain"><option>--max-ampl <replaceable class="option">INTEGER</replaceable></option></arg>
|
||||||
<arg choice="plain"><option>--maxmem <replaceable class="option">NBBYTES</replaceable></option></arg>
|
<arg choice="plain"><option>--maxmem <replaceable class="option">NBBYTES</replaceable></option></arg>
|
||||||
<arg choice="plain"><option>--nowarning</option></arg>
|
<arg choice="plain"><option>--nowarning</option></arg>
|
||||||
<arg choice="plain"><option>--noblanks</option></arg>
|
<arg choice="plain"><option>--noblanks</option></arg>
|
||||||
@ -338,6 +339,18 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>--max-ampl <replaceable class="option">INTEGER</replaceable></option></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Set the maximum amplification factor which protects against
|
||||||
|
exponential entity expansion ("billion laughs"). The default value
|
||||||
|
is 5. Documents making heavy use of entity expansion may require a
|
||||||
|
higher value.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--maxmem <replaceable class="option">NNBYTES</replaceable></option></term>
|
<term><option>--maxmem <replaceable class="option">NNBYTES</replaceable></option></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@ -312,6 +312,7 @@ struct _xmlParserCtxt {
|
|||||||
int endCheckState; /* quote state for push parser */
|
int endCheckState; /* quote state for push parser */
|
||||||
unsigned short nbErrors; /* number of errors */
|
unsigned short nbErrors; /* number of errors */
|
||||||
unsigned short nbWarnings; /* number of warnings */
|
unsigned short nbWarnings; /* number of warnings */
|
||||||
|
unsigned maxAmpl; /* maximum amplification factor */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1149,6 +1150,9 @@ XMLPUBFUN int
|
|||||||
XMLPUBFUN int
|
XMLPUBFUN int
|
||||||
xmlCtxtUseOptions (xmlParserCtxtPtr ctxt,
|
xmlCtxtUseOptions (xmlParserCtxtPtr ctxt,
|
||||||
int options);
|
int options);
|
||||||
|
XMLPUBFUN void
|
||||||
|
xmlCtxtSetMaxAmplification(xmlParserCtxtPtr ctxt,
|
||||||
|
unsigned maxAmpl);
|
||||||
XMLPUBFUN xmlDocPtr
|
XMLPUBFUN xmlDocPtr
|
||||||
xmlReadDoc (const xmlChar *cur,
|
xmlReadDoc (const xmlChar *cur,
|
||||||
const char *URL,
|
const char *URL,
|
||||||
|
@ -121,6 +121,9 @@ XMLPUBFUN int
|
|||||||
xmlTextReaderSetup(xmlTextReaderPtr reader,
|
xmlTextReaderSetup(xmlTextReaderPtr reader,
|
||||||
xmlParserInputBufferPtr input, const char *URL,
|
xmlParserInputBufferPtr input, const char *URL,
|
||||||
const char *encoding, int options);
|
const char *encoding, int options);
|
||||||
|
XMLPUBFUN void
|
||||||
|
xmlTextReaderSetMaxAmplification(xmlTextReaderPtr reader,
|
||||||
|
unsigned maxAmpl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Iterators
|
* Iterators
|
||||||
|
32
parser.c
32
parser.c
@ -121,13 +121,7 @@ xmlParseElementEnd(xmlParserCtxtPtr ctxt);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XML_PARSER_NON_LINEAR is roughly the maximum allowed amplification factor
|
* A certain amount of entity expansion which is always allowed.
|
||||||
* of serialized output after entity expansion.
|
|
||||||
*/
|
|
||||||
#define XML_PARSER_NON_LINEAR 5
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A certain amount is always allowed.
|
|
||||||
*/
|
*/
|
||||||
#define XML_PARSER_ALLOWED_EXPANSION 1000000
|
#define XML_PARSER_ALLOWED_EXPANSION 1000000
|
||||||
|
|
||||||
@ -590,9 +584,10 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, unsigned long extra)
|
|||||||
*/
|
*/
|
||||||
if ((ctxt->sizeentcopy > XML_PARSER_ALLOWED_EXPANSION) &&
|
if ((ctxt->sizeentcopy > XML_PARSER_ALLOWED_EXPANSION) &&
|
||||||
((ctxt->sizeentcopy >= ULONG_MAX) ||
|
((ctxt->sizeentcopy >= ULONG_MAX) ||
|
||||||
(ctxt->sizeentcopy / XML_PARSER_NON_LINEAR > consumed))) {
|
(ctxt->sizeentcopy / ctxt->maxAmpl > consumed))) {
|
||||||
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_LOOP,
|
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_LOOP,
|
||||||
"Maximum entity amplification factor exceeded");
|
"Maximum entity amplification factor exceeded, see "
|
||||||
|
"xmlCtxtSetMaxAmplification.\n");
|
||||||
xmlHaltParser(ctxt);
|
xmlHaltParser(ctxt);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
@ -14301,6 +14296,25 @@ xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
|
|||||||
return(xmlCtxtUseOptionsInternal(ctxt, options, NULL));
|
return(xmlCtxtUseOptionsInternal(ctxt, options, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlCtxtSetMaxAmplification:
|
||||||
|
* @ctxt: an XML parser context
|
||||||
|
* @maxAmpl: maximum amplification factor
|
||||||
|
*
|
||||||
|
* To protect against exponential entity expansion ("billion laughs"), the
|
||||||
|
* size of serialized output is (roughly) limited to the input size
|
||||||
|
* multiplied by this factor. The default value is 5.
|
||||||
|
*
|
||||||
|
* When working with documents making heavy use of entity expansion, it can
|
||||||
|
* be necessary to increase the value. For security reasons, this should only
|
||||||
|
* be considered when processing trusted input.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlCtxtSetMaxAmplification(xmlParserCtxtPtr ctxt, unsigned maxAmpl)
|
||||||
|
{
|
||||||
|
ctxt->maxAmpl = maxAmpl;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlDoRead:
|
* xmlDoRead:
|
||||||
* @ctxt: an XML parser context
|
* @ctxt: an XML parser context
|
||||||
|
@ -49,6 +49,12 @@
|
|||||||
#include "private/io.h"
|
#include "private/io.h"
|
||||||
#include "private/parser.h"
|
#include "private/parser.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XML_MAX_AMPLIFICATION_DEFAULT is the default maximum allowed amplification
|
||||||
|
* factor of serialized output after entity expansion.
|
||||||
|
*/
|
||||||
|
#define XML_MAX_AMPLIFICATION_DEFAULT 5
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Various global defaults for parsing
|
* Various global defaults for parsing
|
||||||
*/
|
*/
|
||||||
@ -2110,6 +2116,7 @@ xmlInitSAXParserCtxt(xmlParserCtxtPtr ctxt, const xmlSAXHandler *sax,
|
|||||||
ctxt->sizeentities = 0;
|
ctxt->sizeentities = 0;
|
||||||
ctxt->sizeentcopy = 0;
|
ctxt->sizeentcopy = 0;
|
||||||
ctxt->input_id = 1;
|
ctxt->input_id = 1;
|
||||||
|
ctxt->maxAmpl = XML_MAX_AMPLIFICATION_DEFAULT;
|
||||||
xmlInitNodeInfoSeq(&ctxt->node_seq);
|
xmlInitNodeInfoSeq(&ctxt->node_seq);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
113
xmllint.c
113
xmllint.c
@ -194,6 +194,7 @@ static const char *xpathquery = NULL;
|
|||||||
static int options = XML_PARSE_COMPACT | XML_PARSE_BIG_LINES;
|
static int options = XML_PARSE_COMPACT | XML_PARSE_BIG_LINES;
|
||||||
static int sax = 0;
|
static int sax = 0;
|
||||||
static int oldxml10 = 0;
|
static int oldxml10 = 0;
|
||||||
|
static unsigned maxAmpl = 0;
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
@ -1648,6 +1649,8 @@ testSAX(const char *filename) {
|
|||||||
progresult = XMLLINT_ERR_MEM;
|
progresult = XMLLINT_ERR_MEM;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (maxAmpl > 0)
|
||||||
|
xmlCtxtSetMaxAmplification(ctxt, maxAmpl);
|
||||||
xmlCtxtReadFile(ctxt, filename, NULL, options);
|
xmlCtxtReadFile(ctxt, filename, NULL, options);
|
||||||
|
|
||||||
if (ctxt->myDoc != NULL) {
|
if (ctxt->myDoc != NULL) {
|
||||||
@ -1799,6 +1802,8 @@ static void streamFile(char *filename) {
|
|||||||
|
|
||||||
|
|
||||||
if (reader != NULL) {
|
if (reader != NULL) {
|
||||||
|
if (maxAmpl > 0)
|
||||||
|
xmlTextReaderSetMaxAmplification(reader, maxAmpl);
|
||||||
#ifdef LIBXML_VALID_ENABLED
|
#ifdef LIBXML_VALID_ENABLED
|
||||||
if (valid)
|
if (valid)
|
||||||
xmlTextReaderSetParserProp(reader, XML_PARSER_VALIDATE, 1);
|
xmlTextReaderSetParserProp(reader, XML_PARSER_VALIDATE, 1);
|
||||||
@ -2220,6 +2225,8 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xmlCtxtUseOptions(ctxt, options);
|
xmlCtxtUseOptions(ctxt, options);
|
||||||
|
if (maxAmpl > 0)
|
||||||
|
xmlCtxtSetMaxAmplification(ctxt, maxAmpl);
|
||||||
while ((res = fread(chars, 1, size, f)) > 0) {
|
while ((res = fread(chars, 1, size, f)) > 0) {
|
||||||
xmlParseChunk(ctxt, chars, res, 0);
|
xmlParseChunk(ctxt, chars, res, 0);
|
||||||
}
|
}
|
||||||
@ -2263,6 +2270,8 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
|||||||
progresult = XMLLINT_ERR_MEM;
|
progresult = XMLLINT_ERR_MEM;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (maxAmpl > 0)
|
||||||
|
xmlCtxtSetMaxAmplification(ctxt, maxAmpl);
|
||||||
} else {
|
} else {
|
||||||
ctxt = rectxt;
|
ctxt = rectxt;
|
||||||
}
|
}
|
||||||
@ -2293,12 +2302,24 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rectxt == NULL)
|
if (rectxt == NULL) {
|
||||||
doc = xmlReadMemory((char *) base, info.st_size,
|
xmlParserCtxtPtr ctxt;
|
||||||
filename, NULL, options);
|
|
||||||
else
|
ctxt = xmlNewParserCtxt();
|
||||||
|
if (ctxt == NULL) {
|
||||||
|
fprintf(stderr, "out of memory\n");
|
||||||
|
progresult = XMLLINT_ERR_MEM;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (maxAmpl > 0)
|
||||||
|
xmlCtxtSetMaxAmplification(ctxt, maxAmpl);
|
||||||
|
doc = xmlCtxtReadMemory(ctxt, base, info.st_size,
|
||||||
|
filename, NULL, options);
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
} else {
|
||||||
doc = xmlCtxtReadMemory(rectxt, (char *) base, info.st_size,
|
doc = xmlCtxtReadMemory(rectxt, (char *) base, info.st_size,
|
||||||
filename, NULL, options);
|
filename, NULL, options);
|
||||||
|
}
|
||||||
|
|
||||||
munmap((char *) base, info.st_size);
|
munmap((char *) base, info.st_size);
|
||||||
close(fd);
|
close(fd);
|
||||||
@ -2317,6 +2338,8 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
|||||||
ctxt = rectxt;
|
ctxt = rectxt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maxAmpl > 0)
|
||||||
|
xmlCtxtSetMaxAmplification(ctxt, maxAmpl);
|
||||||
doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
|
doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
|
||||||
|
|
||||||
if (ctxt->valid == 0)
|
if (ctxt->valid == 0)
|
||||||
@ -2325,10 +2348,22 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
|||||||
xmlFreeParserCtxt(ctxt);
|
xmlFreeParserCtxt(ctxt);
|
||||||
#endif /* LIBXML_VALID_ENABLED */
|
#endif /* LIBXML_VALID_ENABLED */
|
||||||
} else {
|
} else {
|
||||||
if (rectxt != NULL)
|
if (rectxt != NULL) {
|
||||||
doc = xmlCtxtReadFile(rectxt, filename, NULL, options);
|
doc = xmlCtxtReadFile(rectxt, filename, NULL, options);
|
||||||
else
|
} else {
|
||||||
doc = xmlReadFile(filename, NULL, options);
|
xmlParserCtxtPtr ctxt;
|
||||||
|
|
||||||
|
ctxt = xmlNewParserCtxt();
|
||||||
|
if (ctxt == NULL) {
|
||||||
|
fprintf(stderr, "out of memory\n");
|
||||||
|
progresult = XMLLINT_ERR_MEM;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (maxAmpl > 0)
|
||||||
|
xmlCtxtSetMaxAmplification(ctxt, maxAmpl);
|
||||||
|
doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3050,6 +3085,7 @@ static void usage(FILE *f, const char *name) {
|
|||||||
#ifdef LIBXML_XPATH_ENABLED
|
#ifdef LIBXML_XPATH_ENABLED
|
||||||
fprintf(f, "\t--xpath expr: evaluate the XPath expression, imply --noout\n");
|
fprintf(f, "\t--xpath expr: evaluate the XPath expression, imply --noout\n");
|
||||||
#endif
|
#endif
|
||||||
|
fprintf(f, "\t--max-ampl value: set maximum amplification factor\n");
|
||||||
|
|
||||||
fprintf(f, "\nLibxml project home page: https://gitlab.gnome.org/GNOME/libxml2\n");
|
fprintf(f, "\nLibxml project home page: https://gitlab.gnome.org/GNOME/libxml2\n");
|
||||||
}
|
}
|
||||||
@ -3073,6 +3109,26 @@ static void deregisterNode(xmlNodePtr node)
|
|||||||
nbregister--;
|
nbregister--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long
|
||||||
|
parseInteger(const char *ctxt, const char *str,
|
||||||
|
unsigned long min, unsigned long max) {
|
||||||
|
char *strEnd;
|
||||||
|
unsigned long val;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
val = strtoul(str, &strEnd, 10);
|
||||||
|
if (errno == EINVAL || *strEnd != 0) {
|
||||||
|
fprintf(stderr, "%s: invalid integer: %s\n", ctxt, str);
|
||||||
|
exit(XMLLINT_ERR_UNCLASS);
|
||||||
|
}
|
||||||
|
if (errno != 0 || val < min || val > max) {
|
||||||
|
fprintf(stderr, "%s: integer out of range: %s\n", ctxt, str);
|
||||||
|
exit(XMLLINT_ERR_UNCLASS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(val);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv) {
|
main(int argc, char **argv) {
|
||||||
int i, acount;
|
int i, acount;
|
||||||
@ -3092,25 +3148,13 @@ main(int argc, char **argv) {
|
|||||||
|
|
||||||
if ((!strcmp(argv[i], "-maxmem")) ||
|
if ((!strcmp(argv[i], "-maxmem")) ||
|
||||||
(!strcmp(argv[i], "--maxmem"))) {
|
(!strcmp(argv[i], "--maxmem"))) {
|
||||||
char *val_end;
|
|
||||||
long val;
|
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
if (i >= argc) {
|
if (i >= argc) {
|
||||||
fprintf(stderr, "maxmem: missing integer value\n");
|
fprintf(stderr, "maxmem: missing integer value\n");
|
||||||
return(XMLLINT_ERR_UNCLASS);
|
return(XMLLINT_ERR_UNCLASS);
|
||||||
}
|
}
|
||||||
errno = 0;
|
errno = 0;
|
||||||
val = strtol(argv[i], &val_end, 10);
|
maxmem = parseInteger("maxmem", argv[i], 0, INT_MAX);
|
||||||
if (errno == EINVAL || *val_end != 0) {
|
|
||||||
fprintf(stderr, "maxmem: invalid integer: %s\n", argv[i]);
|
|
||||||
return(XMLLINT_ERR_UNCLASS);
|
|
||||||
}
|
|
||||||
if (errno != 0 || val < 0 || val > INT_MAX) {
|
|
||||||
fprintf(stderr, "maxmem: integer out of range: %s\n", argv[i]);
|
|
||||||
return(XMLLINT_ERR_UNCLASS);
|
|
||||||
}
|
|
||||||
maxmem = val;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxmem != 0)
|
if (maxmem != 0)
|
||||||
@ -3446,6 +3490,14 @@ main(int argc, char **argv) {
|
|||||||
(!strcmp(argv[i], "--oldxml10"))) {
|
(!strcmp(argv[i], "--oldxml10"))) {
|
||||||
oldxml10++;
|
oldxml10++;
|
||||||
options |= XML_PARSE_OLD10;
|
options |= XML_PARSE_OLD10;
|
||||||
|
} else if ((!strcmp(argv[i], "-max-ampl")) ||
|
||||||
|
(!strcmp(argv[i], "--max-ampl"))) {
|
||||||
|
i++;
|
||||||
|
if (i >= argc) {
|
||||||
|
fprintf(stderr, "max-ampl: missing integer value\n");
|
||||||
|
return(XMLLINT_ERR_UNCLASS);
|
||||||
|
}
|
||||||
|
maxAmpl = parseInteger("max-ampl", argv[i], 1, UINT_MAX);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Unknown option %s\n", argv[i]);
|
fprintf(stderr, "Unknown option %s\n", argv[i]);
|
||||||
usage(stderr, argv[0]);
|
usage(stderr, argv[0]);
|
||||||
@ -3678,12 +3730,25 @@ main(int argc, char **argv) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if ((!strcmp(argv[i], "-max-ampl")) ||
|
||||||
|
(!strcmp(argv[i], "--max-ampl"))) {
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ((timing) && (repeat))
|
if ((timing) && (repeat))
|
||||||
startTimer();
|
startTimer();
|
||||||
/* Remember file names. "-" means stdin. <sven@zen.org> */
|
/* Remember file names. "-" means stdin. <sven@zen.org> */
|
||||||
if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
|
if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
|
||||||
if (repeat) {
|
if (repeat) {
|
||||||
xmlParserCtxtPtr ctxt = NULL;
|
xmlParserCtxtPtr ctxt;
|
||||||
|
|
||||||
|
ctxt = xmlNewParserCtxt();
|
||||||
|
if (ctxt == NULL) {
|
||||||
|
progresult = XMLLINT_ERR_MEM;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if (maxAmpl > 0)
|
||||||
|
xmlCtxtSetMaxAmplification(ctxt, maxAmpl);
|
||||||
|
|
||||||
for (acount = 0;acount < repeat;acount++) {
|
for (acount = 0;acount < repeat;acount++) {
|
||||||
#ifdef LIBXML_READER_ENABLED
|
#ifdef LIBXML_READER_ENABLED
|
||||||
@ -3694,16 +3759,14 @@ main(int argc, char **argv) {
|
|||||||
if (sax) {
|
if (sax) {
|
||||||
testSAX(argv[i]);
|
testSAX(argv[i]);
|
||||||
} else {
|
} else {
|
||||||
if (ctxt == NULL)
|
|
||||||
ctxt = xmlNewParserCtxt();
|
|
||||||
parseAndPrintFile(argv[i], ctxt);
|
parseAndPrintFile(argv[i], ctxt);
|
||||||
}
|
}
|
||||||
#ifdef LIBXML_READER_ENABLED
|
#ifdef LIBXML_READER_ENABLED
|
||||||
}
|
}
|
||||||
#endif /* LIBXML_READER_ENABLED */
|
#endif /* LIBXML_READER_ENABLED */
|
||||||
}
|
}
|
||||||
if (ctxt != NULL)
|
|
||||||
xmlFreeParserCtxt(ctxt);
|
xmlFreeParserCtxt(ctxt);
|
||||||
} else {
|
} else {
|
||||||
nbregister = 0;
|
nbregister = 0;
|
||||||
|
|
||||||
|
13
xmlreader.c
13
xmlreader.c
@ -5235,6 +5235,19 @@ xmlTextReaderSetup(xmlTextReaderPtr reader,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlTextReaderSetMaxAmplification:
|
||||||
|
* @reader: an XML reader
|
||||||
|
* @maxAmpl: maximum amplification factor
|
||||||
|
*
|
||||||
|
* Set the maximum amplification factor. See xmlCtxtSetMaxAmplification.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlTextReaderSetMaxAmplification(xmlTextReaderPtr reader, unsigned maxAmpl)
|
||||||
|
{
|
||||||
|
xmlCtxtSetMaxAmplification(reader->ctxt, maxAmpl);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlTextReaderByteConsumed:
|
* xmlTextReaderByteConsumed:
|
||||||
* @reader: an XML reader
|
* @reader: an XML reader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user