[gegl] gegl: avoid accessing past end of flattener array
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl: avoid accessing past end of flattener array
- Date: Fri, 1 May 2020 17:13:21 +0000 (UTC)
commit e0e9ec3ffa6681981103f6152cb0604af2a73c09
Author: Øyvind Kolås <pippin gimp org>
Date: Fri May 1 19:10:31 2020 +0200
gegl: avoid accessing past end of flattener array
We do not currently have many additional curve types which need
flatteners so we are not running into this. This commit makes the
code more robust so that if more than 8 flatteners are added
we will not crash. Fixing issue #241.
gegl/property-types/gegl-path.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gegl/property-types/gegl-path.c b/gegl/property-types/gegl-path.c
index 3f04af664..7f9123ddb 100644
--- a/gegl/property-types/gegl-path.c
+++ b/gegl/property-types/gegl-path.c
@@ -997,7 +997,8 @@ gegl_path_add_flattener (GeglPathList *(*flattener) (GeglPathList *original))
if (klass->flattener[i]==NULL)
{
klass->flattener[i] = flattener;
- klass->flattener[i+1] = NULL;
+ if (i + 1 < 8)
+ klass->flattener[i+1] = NULL;
return;
}
}
@@ -1126,7 +1127,7 @@ ensure_flattened (GeglPath *vector)
if (priv->flat_path)
old_path = priv->flat_path;
- for (i=0;klass->flattener[i];i++)
+ for (i=0;klass->flattener[i] && i < 8;i++)
{
new_path = klass->flattener[i] (path);
if (new_path != path)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]