summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Figuière <hub@figuiere.net>2018-02-26 01:50:40 -0500
committerHubert Figuière <hub@figuiere.net>2018-02-26 01:50:40 -0500
commitaabedb5e749dd59112a3fe1e8e08f2d934f56666 (patch)
tree2c68955e5cf686c20cc51cea0222117814acb89d
parent2670adad295c49b0fbb277f35340b32ddf7bc80c (diff)
Bug 105247 - Fix a null dereference in WEBP parser
-rw-r--r--XMPFiles/source/FormatSupport/WEBP_Support.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/XMPFiles/source/FormatSupport/WEBP_Support.cpp b/XMPFiles/source/FormatSupport/WEBP_Support.cpp
index a211697..ffaf220 100644
--- a/XMPFiles/source/FormatSupport/WEBP_Support.cpp
+++ b/XMPFiles/source/FormatSupport/WEBP_Support.cpp
@@ -120,8 +120,10 @@ VP8XChunk::VP8XChunk(Container* parent)
this->data.assign(this->size, 0);
XMP_Uns8* bitstream =
(XMP_Uns8*)parent->chunks[WEBP_CHUNK_IMAGE][0]->data.data();
- XMP_Uns32 width = ((bitstream[7] << 8) | bitstream[6]) & 0x3fff;
- XMP_Uns32 height = ((bitstream[9] << 8) | bitstream[8]) & 0x3fff;
+ // See bug https://bugs.freedesktop.org/show_bug.cgi?id=105247
+ // bitstream could be NULL.
+ XMP_Uns32 width = bitstream ? ((bitstream[7] << 8) | bitstream[6]) & 0x3fff : 0;
+ XMP_Uns32 height = bitstream ? ((bitstream[9] << 8) | bitstream[8]) & 0x3fff : 0;
this->width(width);
this->height(height);
parent->vp8x = this;