Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
libxslt
Commits
d3ec6060
Commit
d3ec6060
authored
Apr 25, 2019
by
Nick Wellnhofer
Browse files
Optional operation limit
Useful to avoid timeouts when fuzzing.
parent
c75b811d
Changes
3
Hide whitespace changes
Inline
Side-by-side
libxslt/transform.c
View file @
d3ec6060
...
...
@@ -2411,6 +2411,17 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
*/
cur
=
list
;
while
(
cur
!=
NULL
)
{
if
(
ctxt
->
opLimit
!=
0
)
{
if
(
ctxt
->
opCount
>=
ctxt
->
opLimit
)
{
xsltTransformError
(
ctxt
,
NULL
,
cur
,
"xsltApplySequenceConstructor: "
"Operation limit exceeded
\n
"
);
ctxt
->
state
=
XSLT_STATE_STOPPED
;
goto
error
;
}
ctxt
->
opCount
+=
1
;
}
ctxt
->
inst
=
cur
;
#ifdef WITH_DEBUGGER
...
...
libxslt/xsltInternals.h
View file @
d3ec6060
...
...
@@ -1780,6 +1780,8 @@ struct _xsltTransformContext {
int
depth
;
/* Needed to catch recursions */
int
maxTemplateDepth
;
int
maxTemplateVars
;
unsigned
long
opLimit
;
unsigned
long
opCount
;
};
/**
...
...
tests/fuzz/xslt.c
View file @
d3ec6060
...
...
@@ -124,6 +124,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
ctxt
=
xsltNewTransformContext
(
sheet
,
doc
);
xsltSetCtxtSecurityPrefs
(
sec
,
ctxt
);
ctxt
->
maxTemplateDepth
=
100
;
ctxt
->
opLimit
=
200000
;
xsltSetXPathResourceLimits
(
ctxt
->
xpathCtxt
);
ctxt
->
xpathCtxt
->
opCount
=
sheet
->
xpathCtxt
->
opCount
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment