Commit cd5e1470 authored by Michael Natterer's avatar Michael Natterer 😴

app, plug-ins: move GIMP_BRUSH_MAX_SIZE to gimpbrush-header.h

and use it in the brush file plug-ins.

(cherry picked from commit 8195a562)
parent b9272f8b
......@@ -18,9 +18,12 @@
#ifndef __GIMP_BRUSH_HEADER_H__
#define __GIMP_BRUSH_HEADER_H__
#define GIMP_BRUSH_FILE_VERSION 2
#define GIMP_BRUSH_MAGIC (('G' << 24) + ('I' << 16) + \
('M' << 8) + ('P' << 0))
#define GIMP_BRUSH_MAX_SIZE 10000 /* Max size in either dimension in px */
/* All field entries are MSB */
......@@ -41,4 +44,5 @@ struct _GimpBrushHeader
* comes the brush data--width * height * bytes bytes of it...
*/
#endif /* __GIMP_BRUSH_HEADER_H__ */
......@@ -21,7 +21,6 @@
#include "gimpdata.h"
#define GIMP_BRUSH_MAX_SIZE 10000 /* Max size in either dimension in px */
#define GIMP_TYPE_BRUSH (gimp_brush_get_type ())
#define GIMP_BRUSH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush))
......
......@@ -30,7 +30,7 @@
#include "gegl/gimp-babl.h"
#include "core/gimpbrush.h"
#include "core/gimpbrush-header.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
......
......@@ -27,6 +27,7 @@
#include "paint-types.h"
#include "core/gimp.h"
#include "core/gimpbrush-header.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpimage.h"
#include "core/gimpdynamics.h"
......
......@@ -29,6 +29,7 @@
#include "core/gimp-palettes.h"
#include "core/gimpbrush.h"
#include "core/gimpbrush-header.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpimage.h"
......
......@@ -386,8 +386,8 @@ load_image (GFile *file,
bh.bytes = g_ntohl (bh.bytes);
/* Sanitize values */
if ((bh.width == 0) || (bh.width > GIMP_MAX_IMAGE_SIZE) ||
(bh.height == 0) || (bh.height > GIMP_MAX_IMAGE_SIZE) ||
if ((bh.width == 0) || (bh.width > GIMP_BRUSH_MAX_SIZE) ||
(bh.height == 0) || (bh.height > GIMP_BRUSH_MAX_SIZE) ||
((bh.bytes != 1) && (bh.bytes != 2) && (bh.bytes != 4) &&
(bh.bytes != 18)) ||
(G_MAXSIZE / bh.width / bh.height / MAX (4, bh.bytes) < 1))
......
......@@ -479,8 +479,8 @@ gih_load_one_brush (GInputStream *input,
bh.spacing = g_ntohl (bh.spacing);
/* Sanitize values */
if ((bh.width == 0) || (bh.width > GIMP_MAX_IMAGE_SIZE) ||
(bh.height == 0) || (bh.height > GIMP_MAX_IMAGE_SIZE) ||
if ((bh.width == 0) || (bh.width > GIMP_BRUSH_MAX_SIZE) ||
(bh.height == 0) || (bh.height > GIMP_BRUSH_MAX_SIZE) ||
((bh.bytes != 1) && (bh.bytes != 4)) ||
(G_MAXSIZE / bh.width / bh.height / bh.bytes < 1))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment