Mask image issue when drawing outside the image
Drawing a rectangle mask ouside an image on the left side of the image actually draws a rectangle mask on the image....
diff --git a/silx/gui/plot/MaskToolsWidget.py b/silx/gui/plot/MaskToolsWidget.py
index c06366f10..a95e277fe 100644
--- a/silx/gui/plot/MaskToolsWidget.py
+++ b/silx/gui/plot/MaskToolsWidget.py
@@ -187,6 +187,8 @@ class ImageMask(BaseMask):
         :param bool mask: True to mask (default), False to unmask.
         """
         assert 0 < level < 256
+        if row + height <= 0 or col + width <= 0:
+            return  # Rectangle outside image, avoid negative indices
         selection = self._mask[max(0, row):row + height + 1,
                                max(0, col):col + width + 1]
         if mask:
['silx/gui/plot/MaskToolsWidget.py']