diff options
author | Dominik Stadler <centic@apache.org> | 2021-01-04 05:51:24 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2021-01-04 05:51:24 +0000 |
commit | b7e9cb48d006ce02e2929551295069d7fa54951b (patch) | |
tree | 846424a5cd3405140f1e24d7ce21c6c8f0bef393 /src/java | |
parent | 43e1d6eba6024527ff2dd68afcd5063cd1b07d75 (diff) | |
download | poi-b7e9cb48d006ce02e2929551295069d7fa54951b.tar.gz poi-b7e9cb48d006ce02e2929551295069d7fa54951b.zip |
Bug 64132: Fix regression introduced by changing factories
We need to return EscherBlipRecord for all types in the defined range of recordId,
not UnknownEscherRecord.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885092 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/poi/ddf/EscherBitmapBlip.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/poi/ddf/EscherRecordTypes.java | 12 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java b/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java index acebed22dc..249e74cb2e 100644 --- a/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java +++ b/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java @@ -61,7 +61,7 @@ public class DefaultEscherRecordFactory implements EscherRecordFactory { return EscherContainerRecord::new; } - if (recordTypes.constructor != null) { + if (recordTypes.constructor != null && recordTypes != EscherRecordTypes.UNKNOWN) { return recordTypes.constructor; } diff --git a/src/java/org/apache/poi/ddf/EscherBitmapBlip.java b/src/java/org/apache/poi/ddf/EscherBitmapBlip.java index 6fa056b8cd..f6d8aea45a 100644 --- a/src/java/org/apache/poi/ddf/EscherBitmapBlip.java +++ b/src/java/org/apache/poi/ddf/EscherBitmapBlip.java @@ -74,7 +74,7 @@ public class EscherBitmapBlip extends EscherBlipRecord { @Override public int getRecordSize() { - return 8 + 16 + 1 + getPicturedata().length; + return 8 + 16 + 1 + (getPicturedata() == null ? 0 : getPicturedata().length); } /** diff --git a/src/java/org/apache/poi/ddf/EscherRecordTypes.java b/src/java/org/apache/poi/ddf/EscherRecordTypes.java index 53afd2f2b8..150bb4300b 100644 --- a/src/java/org/apache/poi/ddf/EscherRecordTypes.java +++ b/src/java/org/apache/poi/ddf/EscherRecordTypes.java @@ -50,12 +50,12 @@ public enum EscherRecordTypes { CLSID(0xf016, null, null, null), CALLOUT_RULE(0xf017, null, null, null), BLIP_START(0xf018, "Blip", "msofbtBlip", null), - BLIP_EMF(0xf018 + 2, "BlipEmf", null, EscherMetafileBlip::new), - BLIP_WMF(0xf018 + 3, "BlipWmf", null, EscherMetafileBlip::new), - BLIP_PICT(0xf018 + 4, "BlipPict", null, EscherMetafileBlip::new), - BLIP_JPEG(0xf018 + 5, "BlipJpeg", null, EscherBitmapBlip::new), - BLIP_PNG(0xf018 + 6, "BlipPng", null, EscherBitmapBlip::new), - BLIP_DIB(0xf018 + 7, "BlipDib", null, EscherBitmapBlip::new), + BLIP_EMF(0xf018 + 2 /* 0xf01a */, "BlipEmf", null, EscherMetafileBlip::new), + BLIP_WMF(0xf018 + 3 /* 0xf01b */, "BlipWmf", null, EscherMetafileBlip::new), + BLIP_PICT(0xf018 + 4 /* 0xf01c */, "BlipPict", null, EscherMetafileBlip::new), + BLIP_JPEG(0xf018 + 5 /* 0xf01d */, "BlipJpeg", null, EscherBitmapBlip::new), + BLIP_PNG(0xf018 + 6 /* 0xf01e */, "BlipPng", null, EscherBitmapBlip::new), + BLIP_DIB(0xf018 + 7 /* 0xf01f */, "BlipDib", null, EscherBitmapBlip::new), BLIP_END(0xf117, "Blip", "msofbtBlip", null), REGROUP_ITEMS(0xf118, null, null, null), SELECTION(0xf119, null, null, null), |