Skip to content

Commit

Permalink
Resolve PLIST entities to zero-length content.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitind authored and iloveeclipse committed Oct 14, 2023
1 parent e68aa53 commit 399fc74
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2012 IBM Corporation and others.
* Copyright (c) 2010, 2023 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -14,6 +14,7 @@
package org.eclipse.jdt.internal.launching;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -101,6 +102,9 @@ private Object parseXML(InputStream stream) throws CoreException, ParserConfigur
Element root = null;
DocumentBuilder parser = XmlProcessorFactoryJdtDebug.createDocumentBuilderIgnoringDOCTYPE();
parser.setErrorHandler(new DefaultHandler());
parser.setEntityResolver((publicId, systemId) -> {
return new InputSource(new ByteArrayInputStream(new byte[0]));
});
root = parser.parse(new InputSource(stream)).getDocumentElement();
if (!root.getNodeName().equalsIgnoreCase(PLIST_ELEMENT)) {
throw getInvalidFormatException();
Expand Down

0 comments on commit 399fc74

Please sign in to comment.