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