Issue #2604 - XCF saving bug in xcf_save_buffer()

The NULL terminator of the tile-offset array of dummy buffer-levels
is erroneously written as an int32, instead of an offset, even in
version-11+ XCFs, in which offsets are 64-bit.

Since the dummy levels aren't actually used by GIMP, we're going to
keep these fields as int32 as an exception, in order to remain
consistent with existing XCFs, and just add a comment in the code,
and update the docs.  If we ever make use of the higher buffer
levels, we should change these fields to offsets, and bump the XCF
version.
This commit is contained in:
Ell 2018-12-04 11:57:40 -05:00
parent c667fdc5c0
commit 2168d91cf7
2 changed files with 14 additions and 2 deletions

View File

@ -1553,6 +1553,15 @@ xcf_save_buffer (XcfInfo *info,
height /= 2;
xcf_write_int32_check_error (info, (guint32 *) &width, 1);
xcf_write_int32_check_error (info, (guint32 *) &height, 1);
/* NOTE: this should be an offset, not an int32! however...
* since there are already 64-bit-offsets XCFs out there in
* which this field is 32-bit, and since it's not actually
* being used, we're going to keep this field 32-bit for the
* dummy levels, to remain consistent. if we ever make use
* of levels above the first, we should turn this field into
* an offset, and bump the xcf version.
*/
xcf_write_int32_check_error (info, (guint32 *) &tmp1, 1);
}

View File

@ -1456,7 +1456,7 @@ checked when GIMP reads the XCF file.
Levels
------
The level structure is laid out as follows:
The level structure for the first level is laid out as follows:
uint32 width Width of the pixel array
uint32 height Height of the pixel array
@ -1465,8 +1465,11 @@ The level structure is laid out as follows:
`--
pointer 0 Zero marks the end of the array of tile pointers.
Due to oversight, in the level structures for the aforementioned
dummy levels, the "pointer" fields are "uint32" instead.
The width and height must be the same as the ones recorded in the
hierarchy structure (except for the aforementioned dummy levels).
hierarchy structure (except for the dummy levels).
Ceil(x) is the smallest integer not smaller than x.