Some PowerPoint Presentation Cannot Be Parsed in Aspose.Slides for Java

Hi,

We encounter an issue with Aspose Slide Java 22.9.
We parse PPTX presentations and render it as PNG images, for some presentations it always fails with the NullPointerException at the presentation parsing phase. We get this crash log:

    2022-10-21 11:20:16.601 ERROR 96692 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] threw exception

    java.lang.NullPointerException: null
    	at com.aspose.slides.internal.of.i.do(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.aw4.do(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.alb.try(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.alb.do(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.Presentation.if(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.Presentation.do(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.Presentation.if(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.Presentation.<init>(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.Presentation.<init>(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.assentis.solpresent.pptxrenderer.services.ThumbnailRenderer.renderThumbnails(ThumbnailRenderer.java:54) ~[classes/:na]
    	at com.assentis.solpresent.pptxrenderer.controllers.ThumbnailRendererController.lambda$convertToZippedPNG$0(ThumbnailRendererController.java:23) ~[classes/:na]
    	at org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBodyReturnValueHandler$StreamingResponseBodyTask.call(StreamingResponseBodyReturnValueHandler.java:111) ~[spring-webmvc-5.3.22.jar:5.3.22]
    	at org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBodyReturnValueHandler$StreamingResponseBodyTask.call(StreamingResponseBodyReturnValueHandler.java:98) ~[spring-webmvc-5.3.22.jar:5.3.22]
    	at org.springframework.web.context.request.async.WebAsyncManager.lambda$startCallableProcessing$4(WebAsyncManager.java:337) ~[spring-web-5.3.22.jar:5.3.22]
    	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
    	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) ~[na:na]
    	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:na]
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    	at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]

    2022-10-21 11:20:16.602 ERROR 96692 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is class com.aspose.slides.PptxReadException ---> java.lang.NullPointerException
       --- End of inner exception stack trace ---
    com.aspose.slides.alb.do(Unknown Source)
    com.aspose.slides.Presentation.if(Unknown Source)
    com.aspose.slides.Presentation.do(Unknown Source)
    com.aspose.slides.Presentation.if(Unknown Source)
    com.aspose.slides.Presentation.<init>(Unknown Source)
    com.aspose.slides.Presentation.<init>(Unknown Source)
    com.assentis.solpresent.pptxrenderer.services.ThumbnailRenderer.renderThumbnails(ThumbnailRenderer.java:54)
    com.assentis.solpresent.pptxrenderer.controllers.ThumbnailRendererController.lambda$convertToZippedPNG$0(ThumbnailRendererController.java:23)
    org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBodyReturnValueHandler$StreamingResponseBodyTask.call(StreamingResponseBodyReturnValueHandler.java:111)
    org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBodyReturnValueHandler$StreamingResponseBodyTask.call(StreamingResponseBodyReturnValueHandler.java:98)
    org.springframework.web.context.request.async.WebAsyncManager.lambda$startCallableProcessing$4(WebAsyncManager.java:337)
    java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
    java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
    java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    java.base/java.lang.Thread.run(Thread.java:829)] with root cause

    java.lang.NullPointerException: null
    	at com.aspose.slides.internal.of.i.do(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.aw4.do(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.alb.try(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.alb.do(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.Presentation.if(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.Presentation.do(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.Presentation.if(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.Presentation.<init>(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.aspose.slides.Presentation.<init>(Unknown Source) ~[aspose-slides-22.9-jdk16.jar:22.9]
    	at com.assentis.solpresent.pptxrenderer.services.ThumbnailRenderer.renderThumbnails(ThumbnailRenderer.java:54) ~[classes/:na]
    	at com.assentis.solpresent.pptxrenderer.controllers.ThumbnailRendererController.lambda$convertToZippedPNG$0(ThumbnailRendererController.java:23) ~[classes/:na]
    	at org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBodyReturnValueHandler$StreamingResponseBodyTask.call(StreamingResponseBodyReturnValueHandler.java:111) ~[spring-webmvc-5.3.22.jar:5.3.22]
    	at org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBodyReturnValueHandler$StreamingResponseBodyTask.call(StreamingResponseBodyReturnValueHandler.java:98) ~[spring-webmvc-5.3.22.jar:5.3.22]
    	at org.springframework.web.context.request.async.WebAsyncManager.lambda$startCallableProcessing$4(WebAsyncManager.java:337) ~[spring-web-5.3.22.jar:5.3.22]
    	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
    	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) ~[na:na]
    	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:na]
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    	at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]

As a precision, the PPTX file that we try to render works with different version of PowerPoint 365 on both Windows and MacOS.
It was also fully validated without error by an OOXML validator.

To give some details about the code calling the parsing of the presentation.
It is ran in a SpringBoot application (spring-boot-starter-parent v2.7.2)

The JDK we run is the following:
openjdk version “11.0.15” 2022-04-19
OpenJDK Runtime Environment Temurin-11.0.15+10 (build 11.0.15+10)
OpenJDK 64-Bit Server VM Temurin-11.0.15+10 (build 11.0.15+10, mixed mode)

The code was also tried on Temurin 11.0.16 with the exact same result.
The SpringBoot application was ran on MacOS, Unix with the same result.

Aspose.Slides is encapsulated in a REST service that we call giving the PPTX presentation as byte array.
We verified the byte array and we can confirm it is the content we expect and it is totally validated.

Extract of the code:

    public void renderThumbnails(byte[] pptx, OutputStream out, boolean highResolutionRendering) throws IOException {

        LOGGER.debug("High resolution activated: {}", () -> highResolutionRendering);

        if (persistParts) {
            Files.write(pptxTemp.resolve("presentation-" + Instant.now().toString() + ".pptx"), pptx);
        }

        Instant start = Instant.now();
        Presentation presentation = new Presentation(new ByteArrayInputStream(pptx));
        int size = presentation.getSlides().size();


        LOGGER.debug("Presentation ({}, {} slide(s)) parsing time: {} ms",
                presentation::hashCode,
                () -> size,
                () -> Duration.between(start, Instant.now()).toMillis());

        try (ZipOutputStream zipOutputStream = new ZipOutputStream(out)) {
            for (int i = 0; i < size; i++) {
                renderSlideAsPNG(zipOutputStream, i, presentation, highResolutionRendering);
            }
        } finally {
            presentation.dispose();
        }

        LOGGER.info("Presentation ({} slide(s)) rendered in {} ms",
                () -> size,
                () -> Duration.between(start, Instant.now()).toMillis());
    }

Has anyone such an issue?

Regards.

@jsenac,
Thank you for describing the issue.

Could you please share the presentation files that are causing the error? You can zip the files and upload them here.

Hi Andrey,

Thanks for your reply.
Sure I can share the presentation.

Here it is: crashing.pptx.zip (73.7 KB)

@jsenac,
Thank you for the presentation file. I’ve reproduced the problem with throwing the exception and added a ticket with ID SLIDESJAVA-38957 to our issue-tracking system. We apologize for any inconvenience. Our development team will investigate the case. You will be notified when a new release of Aspose.Slides with a fix is published.

Hi Andrey,

Thanks for the quick investigation and ticket creation.
We will wait to hear from you.

Have a nice day.
Best regards.

@jsenac,
Thank you for using Aspose.Slides.

The issues you found earlier (filed as SLIDESJAVA-38957) have been fixed in Aspose.Slides for Java 23.1 (JAR).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.