mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +03:00
Optional XPath operation limit
Optionally limit the maximum numbers of XPath operations when evaluating an expression. Useful to avoid timeouts when fuzzing. The following operations count towards the limit: - XPath operations - Location step iterations - Union operations Enabled by setting opLimit to a non-zero value. Note that it's the user's responsibility to reset opCount. This allows to enforce the operation limit across multiple reuses of an XPath context.
This commit is contained in:
@@ -70,7 +70,8 @@ typedef enum {
|
||||
XPATH_INVALID_CHAR_ERROR,
|
||||
XPATH_INVALID_CTXT,
|
||||
XPATH_STACK_ERROR,
|
||||
XPATH_FORBID_VARIABLE_ERROR
|
||||
XPATH_FORBID_VARIABLE_ERROR,
|
||||
XPATH_OP_LIMIT_EXCEEDED
|
||||
} xmlXPathError;
|
||||
|
||||
/*
|
||||
@@ -352,6 +353,10 @@ struct _xmlXPathContext {
|
||||
|
||||
/* Cache for reusal of XPath objects */
|
||||
void *cache;
|
||||
|
||||
/* Resource limits */
|
||||
unsigned long opLimit;
|
||||
unsigned long opCount;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user