about summary refs log tree commit diff
path: root/other/pamstack.c
diff options
context:
space:
mode:
Diffstat (limited to 'other/pamstack.c')
-rw-r--r--other/pamstack.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/other/pamstack.c b/other/pamstack.c
index 308852c8..9e56845f 100644
--- a/other/pamstack.c
+++ b/other/pamstack.c
@@ -186,6 +186,11 @@ processOneImageInAllStreams(unsigned int const nInput,
                 pm_error("Image no. %u does not have the same maxval as "
                          "Image 0.", inputSeq);
         }
+        if (inpam[inputSeq].depth > UINT_MAX - outputDepth)
+            pm_error("Total number of planes is too large to compute "
+                     "(at least %u plus %u)",
+                     outputDepth, inpam[inputSeq].depth);
+
         outputDepth += inpam[inputSeq].depth;
     }