From e526eb44fa3b17823ff34b461ba6f14b65586a52 Mon Sep 17 00:00:00 2001 From: Ed Merks Date: Fri, 13 Dec 2024 13:39:44 +0100 Subject: [PATCH 1/2] Configure XML parsers used for p2 metadata to eliminate entity limits https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/2623 --- .../internal/p2/persistence/XMLParser.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java index 97a6593ae4..3cbfcdaf35 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java @@ -30,6 +30,13 @@ public abstract class XMLParser extends DefaultHandler implements XMLConstants { + // Java 24 and onward restricts the number of entities that may appear in an XML + // document. This limit in too restrictive for p2 XML metadata where a large + // update site can easily have 500,000 or more entities. + // + // https://docs.oracle.com/en/java/javase/17/docs/api/java.xml/module-summary.html#IN_ISFPtable + private static final int MAX_ENTITIES = 0; + // Get the root object that is being parsed. protected abstract Object getRootObject(); @@ -88,6 +95,18 @@ protected SAXParser getParser() throws ParserConfigurationException, SAXExceptio if (theParser == null) { throw new SAXException(Messages.XMLParser_No_SAX_Parser); } + try { + theParser.setProperty("jdk.xml.totalEntitySizeLimit", //$NON-NLS-1$ + Integer.getInteger("jdk.xml.totalEntitySizeLimit", MAX_ENTITIES)); //$NON-NLS-1$ + } catch (SAXException se) { + // Maybe not supported. + } + try { + theParser.setProperty("jdk.xml.maxGeneralEntitySizeLimit", //$NON-NLS-1$ + Integer.getInteger("jdk.xml.maxGeneralEntitySizeLimit", MAX_ENTITIES)); //$NON-NLS-1$ + } catch (SAXException se) { + // Maybe not supported. + } xmlReader = theParser.getXMLReader(); return theParser; } From e4dfa28cc51c529057f9df8a8e8c28d7483cf38f Mon Sep 17 00:00:00 2001 From: Eclipse Equinox Bot Date: Fri, 13 Dec 2024 12:43:17 +0000 Subject: [PATCH 2/2] Version bump(s) for 4.35.0 stream --- bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF index 4340b45fb2..60e295c4d9 100644 --- a/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.repository;singleton:=true -Bundle-Version: 2.9.200.qualifier +Bundle-Version: 2.9.300.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.repository.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin