[gimp/gimp-2-10] Issue #2604 - XCF saving bug in xcf_save_buffer()



commit b06ffe4334a6050c6d8a623d0888b5e093bd1a38
Author: Ell <ell_se yahoo com>
Date:   Tue Dec 4 11:57:40 2018 -0500

    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.
    
    (cherry picked from commit 2168d91cf7a569baaefefe0cc840a24f1bc81272)

 app/xcf/xcf-save.c | 9 +++++++++
 devel-docs/xcf.txt | 7 +++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index 12cf3b24fe..ee5cdcf706 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -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);
         }
 
diff --git a/devel-docs/xcf.txt b/devel-docs/xcf.txt
index b2e8f8704b..1feb1660cb 100644
--- a/devel-docs/xcf.txt
+++ b/devel-docs/xcf.txt
@@ -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.
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]