[gimp] Bug 794679 - warning on scrolling in the gradient dock
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 794679 - warning on scrolling in the gradient dock
- Date: Mon, 26 Mar 2018 16:55:37 +0000 (UTC)
commit 7c4f7c53eac395bf3fb76af543b9c8f5325d6d86
Author: Michael Natterer <mitch gimp org>
Date: Mon Mar 26 18:54:43 2018 +0200
Bug 794679 - warning on scrolling in the gradient dock
Validate all enum fields in gimp_gradient_load(), and reject
gradients with out-of-range values.
app/core/gimpgradient-load.c | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpgradient-load.c b/app/core/gimpgradient-load.c
index 8aead74..cc23086 100644
--- a/app/core/gimpgradient-load.c
+++ b/app/core/gimpgradient-load.c
@@ -182,12 +182,46 @@ gimp_gradient_load (GimpContext *context,
{
case 4:
seg->left_color_type = (GimpGradientColor) left_color_type;
+ if (seg->left_color_type < GIMP_GRADIENT_COLOR_FIXED ||
+ seg->left_color_type > GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT)
+ {
+ g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
+ _("Corrupt segment %d."), i);
+ g_free (line);
+ goto failed;
+ }
+
seg->right_color_type = (GimpGradientColor) right_color_type;
+ if (seg->right_color_type < GIMP_GRADIENT_COLOR_FIXED ||
+ seg->right_color_type > GIMP_GRADIENT_COLOR_BACKGROUND_TRANSPARENT)
+ {
+ g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
+ _("Corrupt segment %d."), i);
+ g_free (line);
+ goto failed;
+ }
/* fall thru */
case 2:
seg->type = (GimpGradientSegmentType) type;
+ if (seg->type < GIMP_GRADIENT_SEGMENT_LINEAR ||
+ seg->type > GIMP_GRADIENT_SEGMENT_SPHERE_DECREASING)
+ {
+ g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
+ _("Corrupt segment %d."), i);
+ g_free (line);
+ goto failed;
+ }
+
seg->color = (GimpGradientSegmentColor) color;
+ if (seg->color < GIMP_GRADIENT_SEGMENT_RGB ||
+ seg->color > GIMP_GRADIENT_SEGMENT_HSV_CW)
+ {
+ g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
+ _("Corrupt segment %d."), i);
+ g_free (line);
+ goto failed;
+ }
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]