1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-09 04:58:16 +03:00

fixed bug #310264, basically it's about reentrancy of count based

* xmlregexp.c: fixed bug #310264, basically it's about reentrancy
  of count based transition, when going though the counter must
  be reset to 0
* test/schemas/bug310264* result/schemas/bug310264*: added the
  regression test.
Daniel
This commit is contained in:
Daniel Veillard 2005-08-08 13:05:13 +00:00
parent 004b5463eb
commit 10752284e3
6 changed files with 85 additions and 1 deletions

View File

@ -1,3 +1,11 @@
Mon Aug 8 15:01:51 CEST 2005 Daniel Veillard <daniel@veillard.com>
* xmlregexp.c: fixed bug #310264, basically it's about reentrancy
of count based transition, when going though the counter must
be reset to 0
* test/schemas/bug310264* result/schemas/bug310264*: added the
regression test.
Mon Aug 8 14:40:52 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
* xmlschemas.c: Fixed a memory leak: xmlSchemaFreeAnnot() was

View File

@ -0,0 +1 @@
./test/schemas/bug310264_0.xml validates

View File

View File

@ -0,0 +1,41 @@
<c xmlns="http://myns" >
<a/> <!-- 1 -->
<a/> <!-- 2 -->
<a/> <!-- 3 -->
<a/> <!-- 4 -->
<a/> <!-- 5 -->
<a/> <!-- 6 -->
<a/> <!-- 7 -->
<a/> <!-- 8 -->
<a/> <!-- 9 -->
<a/> <!-- 10 -->
<a/> <!-- 1 -->
<a/> <!-- 2 -->
<a/> <!-- 3 -->
<a/> <!-- 4 -->
<a/> <!-- 5 -->
<a/> <!-- 6 -->
<a/> <!-- 7 -->
<a/> <!-- 8 -->
<a/> <!-- 9 -->
<a/> <!-- 20 -->
<a/> <!-- 1 -->
<a/> <!-- 2 -->
<a/> <!-- 3 -->
<a/> <!-- 4 -->
<a/> <!-- 5 -->
<a/> <!-- 6 -->
<a/> <!-- 7 -->
<a/> <!-- 8 -->
<a/> <!-- 9 -->
<a/> <!-- 30 -->
<a/> <!-- 1 -->
<a/> <!-- 2 -->
<a/> <!-- 3 -->
<a/> <!-- 4 -->
<a/> <!-- 5 -->
<a/> <!-- 6 -->
<a/> <!-- 7 -->
<a/> <!-- 8 -->
</c>

View File

@ -0,0 +1,18 @@
<xs:schema xmlns:tns="http://myns"
targetNamespace="http://myns"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:element name="a" />
<xs:complexType name="c" >
<xs:sequence minOccurs="2" maxOccurs="4">
<xs:sequence minOccurs="19" maxOccurs="20">
<xs:element ref="tns:a" />
</xs:sequence>
</xs:sequence>
</xs:complexType>
<xs:element name="c" type="tns:c" />
</xs:schema>

View File

@ -38,7 +38,7 @@
#endif
/* #define DEBUG_REGEXP_GRAPH */
/* #define DEBUG_REGEXP_EXEC */
/* #define DEBUG_REGEXP_EXEC */
/* #define DEBUG_PUSH */
/* #define DEBUG_COMPACTION */
@ -2579,6 +2579,14 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) {
#endif
exec->counts[trans->counter]++;
}
if ((trans->count >= 0) &&
(trans->count < REGEXP_ALL_COUNTER)) {
#ifdef DEBUG_REGEXP_EXEC
printf("resetting count %d on transition\n",
trans->count);
#endif
exec->counts[trans->count] = 0;
}
#ifdef DEBUG_REGEXP_EXEC
printf("entering state %d\n", trans->to);
#endif
@ -3146,6 +3154,14 @@ xmlRegExecPushString(xmlRegExecCtxtPtr exec, const xmlChar *value,
#endif
exec->counts[trans->counter]++;
}
if ((trans->count >= 0) &&
(trans->count < REGEXP_ALL_COUNTER)) {
#ifdef DEBUG_REGEXP_EXEC
printf("resetting count %d on transition\n",
trans->count);
#endif
exec->counts[trans->count] = 0;
}
#ifdef DEBUG_PUSH
printf("entering state %d\n", trans->to);
#endif