Logo Search packages:      
Sourcecode: icu version File versions  Download package

U_STABLE void U_EXPORT2 uregex_setStackLimit ( URegularExpression regexp,
int32_t  limit,
UErrorCode status 

Set the amount of heap storage avaliable for use by the match backtracking stack.

ICU uses a backtracking regular expression engine, with the backtrack stack maintained on the heap. This function sets the limit to the amount of memory that can be used for this purpose. A backtracking stack overflow will result in an error from the match operation that caused it.

A limit is desirable because a malicious or poorly designed pattern can use excessive memory, potentially crashing the process. A limit is enabled by default.

regexp The compiled regular expression.
limit The maximum size, in bytes, of the matching backtrack stack. A value of -1 means no limit. The limit must be greater than zero, or -1.
status A reference to a UErrorCode to receive any errors.
ICU 4.0

Definition at line 938 of file uregex.cpp.

    RegularExpression *regexp = (RegularExpression*)regexp2;
    if (validateRE(regexp, status)) {
        regexp->fMatcher->setStackLimit(limit, *status);

Generated by  Doxygen 1.6.0   Back to index