# HG changeset patch # User jdv # Date 1470731127 -19800 # Node ID d0e7204495dcafb29b8f3762127a18bdc3f3f46d # Parent 6a878eae7459b0ea6f527ae8317e3808f65d1384 8160455: KSS : class.forName issue in TIFFImageMetadata.java Reviewed-by: prr, bpb, serb diff -r 6a878eae7459 -r d0e7204495dc jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java Tue Aug 09 13:45:17 2016 +0530 +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java Tue Aug 09 13:55:27 2016 +0530 @@ -1465,8 +1465,14 @@ String className = st.nextToken(); Object o = null; + Class setClass = null; try { - Class setClass = Class.forName(className); + ClassLoader cl = TIFFImageMetadata.class.getClassLoader(); + setClass = Class.forName(className, false, cl); + if (!TIFFTagSet.class.isAssignableFrom(setClass)) { + fatal(node, "TagSets in IFD must be subset of" + + " TIFFTagSet class"); + } Method getInstanceMethod = setClass.getMethod("getInstance", (Class[])null); o = getInstanceMethod.invoke(null, (Object[])null);