@Test public void xxeTestFromByteBuffer() { try { XMPMetaParser.parse(XMP_WITH_XXE.getBytes(), null); } catch (XMPException e) { Assert.assertEquals("Children of resource property element must be XML elements", e.getMessage()); } }
public static XMPMeta parse(Object input, ParseOptions options) throws XMPException { ParameterAsserts.assertNotNull(input); options = options != null ? options : new ParseOptions(); Document document = parseXml(input, options); boolean xmpmetaRequired = options.getRequireXMPMeta(); Object[] result = new Object[3]; result = findRootNode(document, xmpmetaRequired, result); if (result != null && result[1] == XMP_RDF) { XMPMetaImpl xmp = ParseRDF.parse((Node) result[0]); xmp.setPacketHeader((String) result[2]); if (!options.getOmitNormalization()) { return XMPNormalizer.process(xmp, options); } else { return xmp; } } else { return new XMPMetaImpl(); } }
XMPMetaParser { public static XMPMeta parse(Object input, ParseOptions options) throws XMPException { ParameterAsserts.assertNotNull(input); options = options != null ? options : new ParseOptions(); Document document = parseXml(input, options); boolean xmpmetaRequired = options.getRequireXMPMeta(); Object[] result = new Object[3]; result = findRootNode(document, xmpmetaRequired, result); if (result != null && result[1] == XMP_RDF) { XMPMetaImpl xmp = ParseRDF.parse((Node) result[0]); xmp.setPacketHeader((String) result[2]); if (!options.getOmitNormalization()) { return XMPNormalizer.process(xmp, options); } else { return xmp; } } else { return new XMPMetaImpl(); } } }
XMPMetaParser { public static XMPMeta parse(Object input, ParseOptions options) throws XMPException { ParameterAsserts.assertNotNull(input); options = options != null ? options : new ParseOptions(); Document document = parseXml(input, options); boolean xmpmetaRequired = options.getRequireXMPMeta(); Object[] result = new Object[3]; result = findRootNode(document, xmpmetaRequired, result); if (result != null && result[1] == XMP_RDF) { XMPMetaImpl xmp = ParseRDF.parse((Node) result[0]); xmp.setPacketHeader((String) result[2]); if (!options.getOmitNormalization()) { return XMPNormalizer.process(xmp, options); } else { return xmp; } } else { return new XMPMetaImpl(); } } private  XMPMetaParser(); }
XMPMetaParser { public static XMPMeta parse(Object input, ParseOptions options) throws XMPException { ParameterAsserts.assertNotNull(input); options = options != null ? options : new ParseOptions(); Document document = parseXml(input, options); boolean xmpmetaRequired = options.getRequireXMPMeta(); Object[] result = new Object[3]; result = findRootNode(document, xmpmetaRequired, result); if (result != null && result[1] == XMP_RDF) { XMPMetaImpl xmp = ParseRDF.parse((Node) result[0]); xmp.setPacketHeader((String) result[2]); if (!options.getOmitNormalization()) { return XMPNormalizer.process(xmp, options); } else { return xmp; } } else { return new XMPMetaImpl(); } } private  XMPMetaParser(); static XMPMeta parse(Object input, ParseOptions options); }
XMPMetaParser { public static XMPMeta parse(Object input, ParseOptions options) throws XMPException { ParameterAsserts.assertNotNull(input); options = options != null ? options : new ParseOptions(); Document document = parseXml(input, options); boolean xmpmetaRequired = options.getRequireXMPMeta(); Object[] result = new Object[3]; result = findRootNode(document, xmpmetaRequired, result); if (result != null && result[1] == XMP_RDF) { XMPMetaImpl xmp = ParseRDF.parse((Node) result[0]); xmp.setPacketHeader((String) result[2]); if (!options.getOmitNormalization()) { return XMPNormalizer.process(xmp, options); } else { return xmp; } } else { return new XMPMetaImpl(); } } private  XMPMetaParser(); static XMPMeta parse(Object input, ParseOptions options);  }