apache-poi: Allow missing fonts (#11107)

After removing some other "roadblocks" by providing some additional
.so-files, fuzzing now hits some code which is missing installed fonts.

Apache POI already provides a system property to handle this gracefully
where possible.

So let's add this property.

We can also remove one leftover exception handling which should not
appear now.
This commit is contained in:
Dominik Stadler 2023-10-12 14:23:20 +02:00 committed by GitHub
parent cb4b240af7
commit 09c7692d24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 10 deletions

View File

@ -118,7 +118,7 @@ LD_LIBRARY_PATH=\"\$JVM_LD_LIBRARY_PATH\":\$this_dir \
--cp=${RUNTIME_CLASSPATH} \
--instrumentation_includes=org.apache.poi.**:org.apache.xmlbeans.** \
--target_class=${fuzzer_classname} \
--jvm_args=\"-Xmx1024m\" \
--jvm_args=\"-Xmx1024m:-Dorg.apache.poi.ss.ignoreMissingFontSystem=true\" \
\$@" > $OUT/${fuzzer_basename}
chmod u+x $OUT/${fuzzer_basename}
done

View File

@ -32,15 +32,6 @@ public class POIVisioFuzzer {
public static void fuzzerTestOneInput(byte[] input) {
try (XmlVisioDocument visio = new XmlVisioDocument(new ByteArrayInputStream(input))) {
visio.write(NullOutputStream.INSTANCE);
} catch (NoClassDefFoundError e) {
// only allow some missing classes related to Font-handling
// we cannot install JDK font packages in oss-fuzz images currently
// see https://github.com/google/oss-fuzz/issues/7380
if (!e.getMessage().contains("java.awt.Font") &&
!e.getMessage().contains("java.awt.Toolkit") &&
!e.getMessage().contains("sun.awt.X11FontManager")) {
throw e;
}
} catch (IOException | POIXMLException |
BufferUnderflowException | RecordFormatException | OpenXML4JRuntimeException |
IllegalArgumentException | IndexOutOfBoundsException e) {