Avoid NPE with broken file

This commit is contained in:
Dominik Stadler 2026-01-06 23:50:13 +01:00
parent c28aec61d4
commit 0ec4434f59
6 changed files with 11 additions and 4 deletions

View File

@ -408,11 +408,13 @@ public abstract class HSLFShape implements Shape<HSLFShape,HSLFTextParagraph> {
if (fSchemeIndex && sheet != null) {
//red is the index to the color scheme
ColorSchemeAtom ca = sheet.getColorScheme();
int schemeColor = ca.getColor(ecr.getSchemeIndex());
if (ca != null) {
int schemeColor = ca.getColor(ecr.getSchemeIndex());
rgb[0] = (schemeColor >> 0) & 0xFF;
rgb[1] = (schemeColor >> 8) & 0xFF;
rgb[2] = (schemeColor >> 16) & 0xFF;
rgb[0] = (schemeColor >> 0) & 0xFF;
rgb[1] = (schemeColor >> 8) & 0xFF;
rgb[2] = (schemeColor >> 16) & 0xFF;
}
} else if (fPaletteIndex) {
//TODO
} else if (fPaletteRGB) {

View File

@ -1665,6 +1665,9 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText
return null;
}
ColorSchemeAtom ca = sheet.getColorScheme();
if (ca == null) {
throw new IllegalStateException("Cannot read color scheme from sheet");
}
tmp = new Color(ca.getColor(cidx), true);
break;
// Color is an sRGB value specified by red, green, and blue fields.

View File

@ -37,6 +37,7 @@ public class TestPPTXMLDump extends BaseTestPPTIterating {
LOCAL_EXCLUDED.add("clusterfuzz-testcase-minimized-POIHSLFFuzzer-6360479850954752.ppt");
LOCAL_EXCLUDED.add("ppt_with_png_encrypted.ppt");
LOCAL_EXCLUDED.add("clusterfuzz-testcase-minimized-POIHSLFFuzzer-6614960949821440.ppt");
LOCAL_EXCLUDED.add("60f557c0a46bcb0068b1c3e15589dac383307bc8.ppt");
}
@Test

View File

@ -39,6 +39,7 @@ public class TestSlideShowDumper extends BaseTestPPTIterating {
FAILING.add("41384.ppt");
FAILING.add("bug56240.ppt");
FAILING.add("clusterfuzz-testcase-minimized-POIHSLFFuzzer-6360479850954752.ppt");
FAILING.add("60f557c0a46bcb0068b1c3e15589dac383307bc8.ppt");
}
static final Set<String> LOCAL_EXCLUDED = new HashSet<>();

Binary file not shown.