mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
Bug 66425: Avoid a ClassCastException found via oss-fuzz
We try to avoid throwing ClassCastException, but it was possible to trigger one here with a specially crafted input-file Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61400 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911618 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
733d3d10ea
commit
9ae14ef6f0
@ -187,7 +187,7 @@ public final class RecipientChunks implements ChunkGroupWithProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Holds all the chunks that were found. */
|
/** Holds all the chunks that were found. */
|
||||||
private List<Chunk> allChunks = new ArrayList<>();
|
private final List<Chunk> allChunks = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<MAPIProperty, List<PropertyValue>> getProperties() {
|
public Map<MAPIProperty, List<PropertyValue>> getProperties() {
|
||||||
@ -212,21 +212,26 @@ public final class RecipientChunks implements ChunkGroupWithProperties {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void record(Chunk chunk) {
|
public void record(Chunk chunk) {
|
||||||
if (chunk.getChunkId() == RECIPIENT_SEARCH.id) {
|
try {
|
||||||
// TODO - parse
|
if (chunk.getChunkId() == RECIPIENT_SEARCH.id) {
|
||||||
recipientSearchChunk = (ByteChunk) chunk;
|
// TODO - parse
|
||||||
} else if (chunk.getChunkId() == RECIPIENT_NAME.id) {
|
recipientSearchChunk = (ByteChunk) chunk;
|
||||||
recipientDisplayNameChunk = (StringChunk) chunk;
|
} else if (chunk.getChunkId() == RECIPIENT_NAME.id) {
|
||||||
} else if (chunk.getChunkId() == RECIPIENT_DISPLAY_NAME.id) {
|
recipientDisplayNameChunk = (StringChunk) chunk;
|
||||||
recipientNameChunk = (StringChunk) chunk;
|
} else if (chunk.getChunkId() == RECIPIENT_DISPLAY_NAME.id) {
|
||||||
} else if (chunk.getChunkId() == RECIPIENT_EMAIL_ADDRESS.id) {
|
recipientNameChunk = (StringChunk) chunk;
|
||||||
recipientEmailChunk = (StringChunk) chunk;
|
} else if (chunk.getChunkId() == RECIPIENT_EMAIL_ADDRESS.id) {
|
||||||
} else if (chunk.getChunkId() == RECIPIENT_SMTP_ADDRESS.id) {
|
recipientEmailChunk = (StringChunk) chunk;
|
||||||
recipientSMTPChunk = (StringChunk) chunk;
|
} else if (chunk.getChunkId() == RECIPIENT_SMTP_ADDRESS.id) {
|
||||||
} else if (chunk.getChunkId() == DELIVERY_TYPE.id) {
|
recipientSMTPChunk = (StringChunk) chunk;
|
||||||
deliveryTypeChunk = (StringChunk) chunk;
|
} else if (chunk.getChunkId() == DELIVERY_TYPE.id) {
|
||||||
} else if (chunk instanceof PropertiesChunk) {
|
deliveryTypeChunk = (StringChunk) chunk;
|
||||||
recipientProperties = (PropertiesChunk) chunk;
|
} else if (chunk instanceof PropertiesChunk) {
|
||||||
|
recipientProperties = (PropertiesChunk) chunk;
|
||||||
|
}
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
throw new IllegalArgumentException("ChunkId and type of chunk did not match, had id " +
|
||||||
|
chunk.getChunkId() + " and type of chunk: " + chunk.getClass(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// And add to the main list
|
// And add to the main list
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user