ca9047
diff --git a/src/utils/quant_levels_dec_utils.c b/src/utils/quant_levels_dec_utils.c
ca9047
index 3818a78..f65b6cd 100644
ca9047
--- a/src/utils/quant_levels_dec_utils.c
ca9047
+++ b/src/utils/quant_levels_dec_utils.c
ca9047
ca9047
@@ -261,9 +261,15 @@
ca9047
 
ca9047
 int WebPDequantizeLevels(uint8_t* const data, int width, int height, int stride,
ca9047
                          int strength) {
ca9047
-  const int radius = 4 * strength / 100;
ca9047
+  int radius = 4 * strength / 100;
ca9047
+
ca9047
   if (strength < 0 || strength > 100) return 0;
ca9047
   if (data == NULL || width <= 0 || height <= 0) return 0;  // bad params
ca9047
+
ca9047
+  // limit the filter size to not exceed the image dimensions
ca9047
+  if (2 * radius + 1 > width) radius = (width - 1) >> 1;
ca9047
+  if (2 * radius + 1 > height) radius = (height - 1) >> 1;
ca9047
+
ca9047
   if (radius > 0) {
ca9047
     SmoothParams p;
ca9047
     memset(&p, 0, sizeof(p));
ca9047
diff --git a/src/mux/muxread.c b/src/mux/muxread.c
ca9047
index ef50dae..fbe9f05 100644
ca9047
--- a/src/mux/muxread.c
ca9047
+++ b/src/mux/muxread.c
ca9047
ca9047
@@ -138,6 +138,7 @@
ca9047
         wpi->is_partial_ = 1;  // Waiting for a VP8 chunk.
ca9047
         break;
ca9047
       case WEBP_CHUNK_IMAGE:
ca9047
+        if (wpi->img_ != NULL) goto Fail;  // Only 1 image chunk allowed.
ca9047
         if (ChunkSetNth(&subchunk, &wpi->img_, 1) != WEBP_MUX_OK) goto Fail;
ca9047
         if (!MuxImageFinalize(wpi)) goto Fail;
ca9047
         wpi->is_partial_ = 0;  // wpi is completely filled.
ca9047