W3c Schema validation causes Memory overflow with large maxOccurs

PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT
ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW
AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE
DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL
BE LOST SOMEWHERE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3142

*** shadow/3142 Thu Aug 16 01:17:05 2001
--- shadow/3142.tmp.14043       Thu Aug 16 01:17:05 2001
***************
*** 0 ****
--- 1,47 ----
+ +============================================================================+
+ | W3c Schema validation causes Memory overflow with large maxOccurs          |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 3142                        Product: Xerces-J                |
+ |       Status: NEW                         Version: 1.4.2                   |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Normal                   OS/Version: Windows NT/2K           |
+ |     Priority: Other                     Component: SAX                     |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: [EMAIL PROTECTED]                                  |
+ |  Reported By: [EMAIL PROTECTED]                                |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ The Schema
+ 
+ http://ifr.sap.com/catalog/query.jsp?namespace=urn:sap-
+ com:ifr:LO:46C&type=idoc&name=ORDERS02&xml=SCHEMA
+ 
+ can not be used for validation, because it generates memory overflows because 
+ of the maxOccurs="999999" entries.
+ 
+ If I replace the maxOccurs="999999" with maxOccurs="unbounded" everthing is 
+ fine.
+ 
+ The Reason:
+ 
+ The loop in org.apache.xerces.validators.schema.SchemaGrammar makes a huge 
+ number of calls to createContentSpec and allocates a huge amount of memory, if 
+ you enter a large number for maxOccurs in a Schema. 
+ 
+ This causes memory overflows, if a schema contains a large number of elements 
+ with a large number for maxOccurs.
+ 
+ This is the problematic part of the Code:
+ =======================================================
+                 index = optional;
+                 for (int i=0; i < (maxOccurs-minOccurs-1); i++) {
+                     index = addContentSpecNode
+ (XMLContentSpec.CONTENTSPECNODE_SEQ,
+                                                               index,
+                                                               optional,
+                                                               false);
+                 }
+ =====================================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to