Bug#1023452: gimp-plugin-registry: Separate+ plugin crashes

2022-11-07 Thread Ying-Chun Liu (PaulLiu)

Hi Andreas,

Thanks for the patch. I can reproduce this bug.

I also write this test to test if separate runs ok.
Will upload it soon.

Yours,
Paul
#/bin/sh

TEMP=${AUTOPKGTEST_TMP:-${TMPDIR:-$(mktemp -d)}}
TDIR=$(mktemp -d $TEMP/test-separate-1-XX)

convert /usr/share/wallpapers/EveningGlow/contents/images/2560x1440.jpg -resize 
'640x480!' "$TDIR"/origin.jpg

sleep 1

echo "Run separate+..."
gimp-console -i -b "(let* ((i1 (car (gimp-file-load 1 \"$TDIR/origin.jpg\" 
\"$TDIR/origin.jpg\"))) (layer1 (car (gimp-image-get-active-layer i1))) 
(cmykimg (car (plug-in-separate-full 1 i1 layer1 
\"/usr/share/color/icc/colord/SMPTE-C-RGB.icc\" FALSE 
\"/usr/share/color/icc/ghostscript/gray_to_k.icc\" 1 FALSE FALSE FALSE 
FALSE (gimp-xcf-save 1 cmykimg (car (gimp-image-get-active-drawable 
cmykimg)) \"$TDIR/output.xcf\" \"$TDIR/output.xcf\") (gimp-quit 1))"

sleep 2

if [ ! -e "$TDIR"/output.xcf ]; then
   echo "No output.xcf"
   exit 404
fi


OpenPGP_0x44173FA13D05.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Bug#1023452: gimp-plugin-registry: Separate+ plugin crashes

2022-11-07 Thread Andreas Heinlein
It looks like the attached patch seems to work.--- a/separate+/src/separate-core.c
+++ b/separate+/src/separate-core.c
@@ -431,7 +431,7 @@
 for (counter = 0; counter < n_drawables; ++counter)
   gimp_pixel_rgn_init ([counter], drawables[counter], 0, 0, width, height, TRUE, FALSE);
 
-sc->cmyktemp = g_new (guchar, 64 * 64 * 4);
+sc->cmyktemp = g_new (guchar, gimp_tile_width () * gimp_tile_height () * 4);
 
 gimp_progress_init (_("Separating..."));
 ntiles = drawable->ntile_rows * drawable->ntile_cols;
@@ -549,7 +549,7 @@
 n_drawables++;
   }
 
-sc->cmyktemp = g_new (guchar, 64 * 64 * 4);
+sc->cmyktemp = g_new (guchar, gimp_tile_width () * gimp_tile_height () * 4);
 
 gimp_progress_init (_("Separating..."));
 ntiles = drawable->ntile_cols * drawable->ntile_rows;


Bug#1023452: gimp-plugin-registry: Separate+ plugin crashes

2022-11-04 Thread Andreas Heinlein
Package: gimp-plugin-registry
Version: 9.20200927
Severity: normal
Tags: upstream
X-Debbugs-Cc: aheinl...@gmx.com

The separate+ plugin dies with a segfault when trying to run it.

(separate:22416): LibGimp-CRITICAL **: 14:10:05.069: gimp_tile_unref: assertion 
'tile->ref_count > 0' failed

(separate:22416): LibGimp-CRITICAL **: 14:10:05.069: gimp_tile_unref: assertion 
'tile->ref_count > 0' failed

(separate:22416): LibGimp-CRITICAL **: 14:10:05.069: gimp_tile_unref: assertion 
'tile->ref_count > 0' failed
/usr/lib/gimp/2.0/plug-ins/separate: fatal error: Speicherzugriffsfehler
gimp: GEGL-WARNUNG: 
(../gegl/buffer/gegl-tile-handler-cache.c:1076):gegl_tile_cache_destroy: 
runtime check failed: (g_queue_is_empty (_queue))
eEeek! 5 GeglBuffers leaked

Steps to reproduce:

* Run GIMP, open any image
* Click Image>Separate>Separate
* Confirm dialog with OK
* Plugin crashes

The problem has already been identified and dicussed here:

https://gitlab.gnome.org/GNOME/gimp/-/issues/2305

In short, the problem seems to be that the plugin "assumes that gimp_tile_width 
()
and gimp_tile_height () return 64, but evidently tiles changed size in 
gimp-2.10 and
so third-party plug-ins have to be adjusted"

There is a proposed patch which I don't know (yet) if it works:

In this case the problem is in separate-core.c, line 545 should have been:

sc->cmyktemp = g_new (guchar, gimp_tile_width () * gimp_tile_height () * 4);

but probably there is the same problem at line 429:

sc->cmyktemp = g_new (guchar, 64 * 64 * 4);

The plugin itself seems to have been abandoned long ago, so there is no chance 
to get
it fixed upstream. But if above patch works, it should be possible to include 
it in
the debian package.
I will give it a try and report back when I have found out something.

-- System Information:
Debian Release: 11.5
  APT prefers stable-updates
  APT policy: (900, 'stable-updates'), (900, 'stable'), (500, 'stable-security')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-18-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gimp-plugin-registry depends on:
ii  gimp2.10.22-4
ii  libc6   2.31-13+deb11u5
ii  libgcc-s1   10.2.1-6
ii  libgdk-pixbuf2.0-0  2.40.2-2
ii  libgimp2.0  2.10.22-4
ii  libglib2.0-02.66.8-1
ii  libgtk2.0-0 2.24.33-2
ii  libjpeg62-turbo 1:2.0.6-4
ii  liblcms2-2  2.12~rc1-2
ii  liblqr-1-0  0.4.2-2.1
ii  libpango-1.0-0  1.46.2-3
ii  libstdc++6  10.2.1-6
ii  libtiff-tools   4.2.0-1+deb11u1
ii  libtiff54.2.0-1+deb11u1
ii  python3 3.9.2-3
ii  xdg-utils   1.1.3-4.1

Versions of packages gimp-plugin-registry recommends:
ii  gimp-gmic  2.9.4-4

Versions of packages gimp-plugin-registry suggests:
pn  icc-profiles  

-- no debconf information