2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2000-02-25 00:11:26 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2000-02-25 00:11:26 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2000-02-25 00:11:26 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2000-02-25 00:11:26 +08:00
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2001-07-04 02:38:56 +08:00
|
|
|
#ifndef __XCF_PRIVATE_H__
|
|
|
|
#define __XCF_PRIVATE_H__
|
|
|
|
|
|
|
|
|
app: limit allowable tile data size in XCFs
When loading tiles from an XCF, reject tiles whose on-disk size is
greater than 1.5 times the size of an uncompressed tile -- a limit
that is already present for the last tile in the buffer. This
should allow for the possibility of negative compression, while
restricting placing a realistic limit.
Currently, no limit is placed on the on-disk tile data size. When
loading RLE- and zlib-compressed tiles, a buffer large enough to
hold the entire on-disk tile data, up to 2GB, is allocated on the
stack, and the data is read into it. If the file is smaller than
the reported tile data size, the area of the buffer past the end
of the file is not touched. This allows a malicious XCF to write
up to 2GB of arbitrary data, at an arbitrary offset, up to 2GB,
below the stack.
Note that a similar issue had existed for earlier versions of GIMP
(see commit d7a9e6079d3e65baa516f302eb285fb2bbd97c2f), however,
since prior to 2.9 the tile data buffer was allocated on the heap,
the potential risk is far smaller.
2017-07-10 05:20:30 +08:00
|
|
|
#define XCF_TILE_WIDTH 64
|
|
|
|
#define XCF_TILE_HEIGHT 64
|
|
|
|
#define XCF_TILE_MAX_DATA_LENGTH_FACTOR 1.5
|
2012-04-03 05:32:38 +08:00
|
|
|
|
2001-07-04 02:38:56 +08:00
|
|
|
typedef enum
|
|
|
|
{
|
2005-07-11 05:17:22 +08:00
|
|
|
PROP_END = 0,
|
|
|
|
PROP_COLORMAP = 1,
|
|
|
|
PROP_ACTIVE_LAYER = 2,
|
|
|
|
PROP_ACTIVE_CHANNEL = 3,
|
|
|
|
PROP_SELECTION = 4,
|
|
|
|
PROP_FLOATING_SELECTION = 5,
|
|
|
|
PROP_OPACITY = 6,
|
|
|
|
PROP_MODE = 7,
|
|
|
|
PROP_VISIBLE = 8,
|
|
|
|
PROP_LINKED = 9,
|
|
|
|
PROP_LOCK_ALPHA = 10,
|
|
|
|
PROP_APPLY_MASK = 11,
|
|
|
|
PROP_EDIT_MASK = 12,
|
|
|
|
PROP_SHOW_MASK = 13,
|
|
|
|
PROP_SHOW_MASKED = 14,
|
|
|
|
PROP_OFFSETS = 15,
|
|
|
|
PROP_COLOR = 16,
|
|
|
|
PROP_COMPRESSION = 17,
|
|
|
|
PROP_GUIDES = 18,
|
|
|
|
PROP_RESOLUTION = 19,
|
|
|
|
PROP_TATTOO = 20,
|
|
|
|
PROP_PARASITES = 21,
|
|
|
|
PROP_UNIT = 22,
|
|
|
|
PROP_PATHS = 23,
|
|
|
|
PROP_USER_UNIT = 24,
|
|
|
|
PROP_VECTORS = 25,
|
2006-08-11 01:10:12 +08:00
|
|
|
PROP_TEXT_LAYER_FLAGS = 26,
|
2018-07-16 07:42:19 +08:00
|
|
|
PROP_OLD_SAMPLE_POINTS = 27,
|
2009-08-31 03:28:59 +08:00
|
|
|
PROP_LOCK_CONTENT = 28,
|
|
|
|
PROP_GROUP_ITEM = 29,
|
2011-09-26 03:57:20 +08:00
|
|
|
PROP_ITEM_PATH = 30,
|
2012-11-09 18:17:25 +08:00
|
|
|
PROP_GROUP_ITEM_FLAGS = 31,
|
2015-10-17 03:59:11 +08:00
|
|
|
PROP_LOCK_POSITION = 32,
|
2016-11-15 06:02:43 +08:00
|
|
|
PROP_FLOAT_OPACITY = 33,
|
|
|
|
PROP_COLOR_TAG = 34,
|
2017-02-13 06:49:26 +08:00
|
|
|
PROP_COMPOSITE_MODE = 35,
|
|
|
|
PROP_COMPOSITE_SPACE = 36,
|
2017-03-25 05:35:57 +08:00
|
|
|
PROP_BLEND_SPACE = 37,
|
2018-07-16 07:42:19 +08:00
|
|
|
PROP_FLOAT_COLOR = 38,
|
|
|
|
PROP_SAMPLE_POINTS = 39,
|
2001-07-04 02:38:56 +08:00
|
|
|
} PropType;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
2001-07-19 23:34:19 +08:00
|
|
|
COMPRESS_NONE = 0,
|
|
|
|
COMPRESS_RLE = 1,
|
|
|
|
COMPRESS_ZLIB = 2, /* unused */
|
|
|
|
COMPRESS_FRACTAL = 3 /* unused */
|
|
|
|
} XcfCompressionType;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
XCF_ORIENTATION_HORIZONTAL = 1,
|
|
|
|
XCF_ORIENTATION_VERTICAL = 2
|
|
|
|
} XcfOrientationType;
|
|
|
|
|
2003-09-09 23:46:59 +08:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
XCF_STROKETYPE_STROKE = 0,
|
|
|
|
XCF_STROKETYPE_BEZIER_STROKE = 1
|
|
|
|
} XcfStrokeType;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2011-10-08 02:05:52 +08:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
XCF_GROUP_ITEM_EXPANDED = 1
|
|
|
|
} XcfGroupItemFlagsType;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
typedef struct _XcfInfo XcfInfo;
|
|
|
|
|
|
|
|
struct _XcfInfo
|
|
|
|
{
|
2006-08-09 05:06:36 +08:00
|
|
|
Gimp *gimp;
|
|
|
|
GimpProgress *progress;
|
2013-10-09 03:22:14 +08:00
|
|
|
GInputStream *input;
|
|
|
|
GOutputStream *output;
|
|
|
|
GSeekable *seekable;
|
2017-03-23 18:44:41 +08:00
|
|
|
goffset cp;
|
|
|
|
gint bytes_per_offset;
|
2015-07-14 04:43:22 +08:00
|
|
|
GFile *file;
|
2003-12-06 23:53:26 +08:00
|
|
|
GimpTattoo tattoo_state;
|
2001-07-19 23:34:19 +08:00
|
|
|
GimpLayer *active_layer;
|
|
|
|
GimpChannel *active_channel;
|
|
|
|
GimpDrawable *floating_sel_drawable;
|
|
|
|
GimpLayer *floating_sel;
|
2017-03-23 18:44:41 +08:00
|
|
|
goffset floating_sel_offset;
|
2001-07-19 23:34:19 +08:00
|
|
|
XcfCompressionType compression;
|
|
|
|
gint file_version;
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-07-04 02:38:56 +08:00
|
|
|
#endif /* __XCF_PRIVATE_H__ */
|