Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package chafa for openSUSE:Factory checked 
in at 2022-11-14 14:28:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/chafa (Old)
 and      /work/SRC/openSUSE:Factory/.chafa.new.1597 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "chafa"

Mon Nov 14 14:28:56 2022 rev:17 rq:1035537 version:1.12.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/chafa/chafa.changes      2022-07-05 
12:09:46.668582377 +0200
+++ /work/SRC/openSUSE:Factory/.chafa.new.1597/chafa.changes    2022-11-14 
14:29:05.759000874 +0100
@@ -0,0 +1,22 @@
+
+Sun Nov 13 20:17:11 UTC 2022 - Michael Vetter <mvet...@suse.com>
+
+- Update to 1.12.4:
+  * MS Windows: Added support for Unicode command-line arguments.
+  * MS Windows: Enabled support for building a DLL.
+  * Improved quality of accelerated symbol picking (the default
+    with -w 6 and lower), especially along sharp edges.
+  * The XWD loader now supports unaligned image data, which can
+    occur when the header is of an uneven length. Such images
+    will no longer be rejected.
+  * Bug fixes:
+    - #100[1] Reading image data from stdin fails on Windows
+    - #104[3] Artifacts with transparent animations on Kitty
+    - #108[5] Bad interaction with lolcat
+    - #112[7] Bad documentation for -c default
+    - #113[9] Autogen/build fails on CentOS 7 (partial solution)
+    - huntr.dev: Uncontrolled memory allocation in lodepng
+    - [unfiled] -lm should not be in pkg-config Libs: list
+    - [unfiled] The --watch switch was broken with the
+      introduction of --animate.
+

Old:
----
  chafa-1.12.3.tar.xz

New:
----
  chafa-1.12.4.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ chafa.spec ++++++
--- /var/tmp/diff_new_pack.p0sfcw/_old  2022-11-14 14:29:06.259003189 +0100
+++ /var/tmp/diff_new_pack.p0sfcw/_new  2022-11-14 14:29:06.263003207 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           chafa
-Version:        1.12.3
+Version:        1.12.4
 Release:        0
 Summary:        Image-to-text converter for terminal
 License:        LGPL-3.0-or-later

++++++ chafa-1.12.3.tar.xz -> chafa-1.12.4.tar.xz ++++++
++++ 2371 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/NEWS new/chafa-1.12.4/NEWS
--- old/chafa-1.12.3/NEWS       2022-07-01 01:09:11.000000000 +0200
+++ new/chafa-1.12.4/NEWS       2022-11-12 02:16:43.000000000 +0100
@@ -1,6 +1,34 @@
 Chafa releases
 ==============
 
+1.12.4 (2022-11-12)
+-------------------
+
+This release improves support for Microsoft Windows and fixes several bugs.
+
+* MS Windows: Added support for Unicode command-line arguments.
+
+* MS Windows: Enabled support for building a DLL.
+
+* Improved quality of accelerated symbol picking (the default with -w 6 and
+  lower), especially along sharp edges.
+
+* The XWD loader now supports unaligned image data, which can occur when the
+  header is of an uneven length. Such images will no longer be rejected.
+
+* Bug fixes:
+  github#100  Reading image data from stdin fails on Windows (reported by
+              @TransparentLC).
+  github#104  Artifacts with transparent animations on Kitty (reported by Akash
+              Patel).
+  github#112  Bad documentation for -c default (reported by Jakub Wilk).
+  github#113  Autogen/build fails on CentOS 7 (partial solution) (reported by
+              Ivan Shatsky).
+  huntr.dev   Uncontrolled memory allocation in lodepng (reported by
+              @JieyongMa).
+  [unfiled]   -lm should not be in pkg-config Libs: list (Tomasz Kłoczko).
+  [unfiled]   The --watch switch was broken with the introduction of --animate.
+
 1.12.3 (2022-07-01)
 -------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/Makefile.am new/chafa-1.12.4/chafa/Makefile.am
--- old/chafa-1.12.3/chafa/Makefile.am  2022-07-01 01:09:11.000000000 +0200
+++ new/chafa-1.12.4/chafa/Makefile.am  2022-11-12 02:16:56.000000000 +0100
@@ -9,7 +9,7 @@
 noinst_HEADERS =
 
 libchafa_la_CFLAGS = $(LIBCHAFA_CFLAGS) $(GLIB_CFLAGS) -DCHAFA_COMPILATION
-libchafa_la_LDFLAGS = $(LIBCHAFA_LDFLAGS) -version-info 8:3:8
+libchafa_la_LDFLAGS = $(LIBCHAFA_LDFLAGS) -no-undefined -version-info 8:4:8
 libchafa_la_LIBADD = $(GLIB_LIBS) internal/libchafa-internal.la -lm
 
 libchafa_la_SOURCES = \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/chafa-canvas.c new/chafa-1.12.4/chafa/chafa-canvas.c
--- old/chafa-1.12.3/chafa/chafa-canvas.c       2022-06-20 00:20:07.000000000 
+0200
+++ new/chafa-1.12.4/chafa/chafa-canvas.c       2022-11-12 02:16:36.000000000 
+0100
@@ -973,7 +973,18 @@
              * sure the "blank" char has no foreground features. It's safest to
              * permit this optimization only with ASCII space. */
             if (canvas->blank_char == ' ' && cx > 0)
+            {
                 cells [cx].fg_color = cells [cx - 1].fg_color;
+
+                /* We may use inverted colors when the foreground is 
transparent.
+                 * Some downstream tools don't handle this and will keep
+                 * modulating the wrong pen. In order to suppress long runs of
+                 * artifacts, make the (unused) foreground pen opaque 
(gh#108). */
+                if (canvas->config.canvas_mode == CHAFA_CANVAS_MODE_TRUECOLOR)
+                    cells [cx].fg_color |= 0xff000000;
+                else if (cells [cx].fg_color == 
CHAFA_PALETTE_INDEX_TRANSPARENT)
+                    cells [cx].fg_color = CHAFA_PALETTE_INDEX_FG;
+            }
         }
     }
 }
@@ -1561,6 +1572,11 @@
     }
     else if (canvas->config.pixel_mode == CHAFA_PIXEL_MODE_KITTY)
     {
+        ChafaColor bg_color;
+
+        chafa_unpack_color (canvas->config.bg_color_packed_rgb, &bg_color);
+        bg_color.ch [3] = canvas->config.alpha_threshold < 1 ? 0x00 : 0xff;
+
         /* Kitty mode */
 
         canvas->fg_palette.alpha_threshold = canvas->config.alpha_threshold;
@@ -1570,7 +1586,8 @@
                                             src_pixel_type,
                                             src_pixels,
                                             src_width, src_height,
-                                            src_rowstride);
+                                            src_rowstride,
+                                            bg_color);
     }
     else  /* if (canvas->config.pixel_mode == CHAFA_PIXEL_MODE_ITERM2) */
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/chafa-term-seq-doc.h 
new/chafa-1.12.4/chafa/chafa-term-seq-doc.h
--- old/chafa-1.12.3/chafa/chafa-term-seq-doc.h 2022-06-28 01:14:05.000000000 
+0200
+++ new/chafa-1.12.4/chafa/chafa-term-seq-doc.h 2022-11-12 02:23:49.000000000 
+0100
@@ -4,7 +4,7 @@
 # 1 "/usr/include/stdc-predef.h" 1 3 4
 
 # 1 "/usr/include/stdc-predef.h" 3 4
-/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -38,7 +38,7 @@
    whether the overall intent is to support these features; otherwise,
    presume an older compiler has intent to support these features and
    define these macros by default.  */
-# 52 "/usr/include/stdc-predef.h" 3 4
+# 56 "/usr/include/stdc-predef.h" 3 4
 /* wchar_t uses Unicode 10.0.0.  Version 10.0 of the Unicode Standard is
    synchronized with ISO/IEC 10646:2017, fifth edition, plus
    the following additions from Amendment 1 to the fifth edition:
@@ -118,6 +118,10 @@
  * Sixels: https://vt100.net/docs/vt3xx-gp/chapter14.html
  */
 
+/* For zero-argument functions, we use "char" as the argument type instead
+ * of the more appropriate "void", since we need to be able to use it with
+ * sizeof() and -Wpointer-arith. */
+
 /* __VA_OPT__ from C++2a would be nice, but it's too recent to rely on in
  * public headers just yet. So we have this exciting trick instead. */
 
@@ -1215,6 +1219,10 @@
  * Sixels: https://vt100.net/docs/vt3xx-gp/chapter14.html
  */
 
+/* For zero-argument functions, we use "char" as the argument type instead
+ * of the more appropriate "void", since we need to be able to use it with
+ * sizeof() and -Wpointer-arith. */
+
 /* __VA_OPT__ from C++2a would be nice, but it's too recent to rely on in
  * public headers just yet. So we have this exciting trick instead. */
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/internal/chafa-kitty-canvas.c 
new/chafa-1.12.4/chafa/internal/chafa-kitty-canvas.c
--- old/chafa-1.12.3/chafa/internal/chafa-kitty-canvas.c        2022-07-01 
01:09:11.000000000 +0200
+++ new/chafa-1.12.4/chafa/internal/chafa-kitty-canvas.c        2022-11-12 
02:16:36.000000000 +0100
@@ -26,6 +26,7 @@
 #include "internal/chafa-bitfield.h"
 #include "internal/chafa-indexed-image.h"
 #include "internal/chafa-kitty-canvas.h"
+#include "internal/chafa-pixops.h"
 #include "internal/chafa-string-util.h"
 
 typedef struct
@@ -39,6 +40,8 @@
 {
     ChafaKittyCanvas *kitty_canvas;
     SmolScaleCtx *scale_ctx;
+    ChafaColor bg_color;
+    gboolean flatten_alpha;
 }
 DrawCtx;
 
@@ -47,7 +50,7 @@
 {
     ChafaKittyCanvas *kitty_canvas;
 
-    kitty_canvas = g_new (ChafaKittyCanvas, 1);
+    kitty_canvas = g_new0 (ChafaKittyCanvas, 1);
     kitty_canvas->width = width;
     kitty_canvas->height = height;
     kitty_canvas->rgba_image = g_malloc (width * height * sizeof (guint32));
@@ -69,12 +72,21 @@
                            ((guint32 *) ctx->kitty_canvas->rgba_image) + 
(ctx->kitty_canvas->width * batch->first_row),
                            batch->first_row,
                            batch->n_rows);
+
+    /* FIXME: Smolscale should be able to do this */
+    if (ctx->flatten_alpha)
+        chafa_composite_rgba_on_solid_color (ctx->bg_color,
+                                             ctx->kitty_canvas->rgba_image,
+                                             ctx->kitty_canvas->width,
+                                             batch->first_row,
+                                             batch->n_rows);
 }
 
 void
 chafa_kitty_canvas_draw_all_pixels (ChafaKittyCanvas *kitty_canvas, 
ChafaPixelType src_pixel_type,
                                     gconstpointer src_pixels,
-                                    gint src_width, gint src_height, gint 
src_rowstride)
+                                    gint src_width, gint src_height, gint 
src_rowstride,
+                                    ChafaColor bg_color)
 {
     DrawCtx ctx;
 
@@ -100,6 +112,8 @@
                                          kitty_canvas->width * sizeof 
(guint32),
                                          NULL,
                                          &ctx);
+    ctx.bg_color = bg_color;
+    ctx.flatten_alpha = bg_color.ch [3] == 0;
 
     chafa_process_batches (&ctx,
                            (GFunc) draw_pixels_worker,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/internal/chafa-kitty-canvas.h 
new/chafa-1.12.4/chafa/internal/chafa-kitty-canvas.h
--- old/chafa-1.12.3/chafa/internal/chafa-kitty-canvas.h        2022-06-20 
00:20:07.000000000 +0200
+++ new/chafa-1.12.4/chafa/internal/chafa-kitty-canvas.h        2022-11-12 
02:16:36.000000000 +0100
@@ -34,9 +34,11 @@
 ChafaKittyCanvas *chafa_kitty_canvas_new (gint width, gint height);
 void chafa_kitty_canvas_destroy (ChafaKittyCanvas *kitty_canvas);
 
-void chafa_kitty_canvas_draw_all_pixels (ChafaKittyCanvas *kitty_canvas, 
ChafaPixelType src_pixel_type,
+void chafa_kitty_canvas_draw_all_pixels (ChafaKittyCanvas *kitty_canvas,
+                                         ChafaPixelType src_pixel_type,
                                          gconstpointer src_pixels,
-                                         gint src_width, gint src_height, gint 
src_rowstride);
+                                         gint src_width, gint src_height, gint 
src_rowstride,
+                                         ChafaColor bg_color);
 void chafa_kitty_canvas_build_ansi (ChafaKittyCanvas *kitty_canvas, 
ChafaTermInfo *term_info, GString *out_str,
                                     gint width_cells, gint height_cells);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/internal/chafa-pixops.c 
new/chafa-1.12.4/chafa/internal/chafa-pixops.c
--- old/chafa-1.12.3/chafa/internal/chafa-pixops.c      2022-06-20 
00:20:07.000000000 +0200
+++ new/chafa-1.12.4/chafa/internal/chafa-pixops.c      2022-11-12 
02:16:36.000000000 +0100
@@ -620,6 +620,33 @@
     }
 }
 
+/* FIXME: Could we always destroy the alpha channel and eliminate the other
+ * variant? */
+static void
+composite_alpha_on_solid (ChafaColor bg_color,
+                          ChafaPixel *pixels, gint width, gint first_row, gint 
n_rows)
+{
+    ChafaPixel *p0, *p1;
+
+    p0 = pixels + first_row * width;
+    p1 = p0 + n_rows * width;
+
+    for ( ; p0 < p1; p0++)
+    {
+        p0->col.ch [0] += (bg_color.ch [0] * (255 - (guint32) p0->col.ch [3])) 
/ 255;
+        p0->col.ch [1] += (bg_color.ch [1] * (255 - (guint32) p0->col.ch [3])) 
/ 255;
+        p0->col.ch [2] += (bg_color.ch [2] * (255 - (guint32) p0->col.ch [3])) 
/ 255;
+        p0->col.ch [3] = 0xff;
+    }
+}
+
+void
+chafa_composite_rgba_on_solid_color (ChafaColor color,
+                                     ChafaPixel *pixels, gint width, gint 
first_row, gint n_rows)
+{
+    composite_alpha_on_solid (color, pixels, width, first_row, n_rows);
+}
+
 static void
 prepare_pixels_2_worker (ChafaBatchInfo *batch, PrepareContext *prep_ctx)
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/internal/chafa-pixops.h 
new/chafa-1.12.4/chafa/internal/chafa-pixops.h
--- old/chafa-1.12.3/chafa/internal/chafa-pixops.h      2022-06-20 
00:20:07.000000000 +0200
+++ new/chafa-1.12.4/chafa/internal/chafa-pixops.h      2022-11-12 
02:16:36.000000000 +0100
@@ -43,6 +43,9 @@
                                         const ChafaPixel *pixels, gint 
n_pixels,
                                         gint ch);
 
+void chafa_composite_rgba_on_solid_color (ChafaColor color,
+                                          ChafaPixel *pixels, gint width, gint 
first_row, gint n_rows);
+
 G_END_DECLS
 
 #endif /* __CHAFA_PIXOPS_H__ */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/internal/chafa-work-cell.c 
new/chafa-1.12.4/chafa/internal/chafa-work-cell.c
--- old/chafa-1.12.3/chafa/internal/chafa-work-cell.c   2022-07-01 
01:09:11.000000000 +0200
+++ new/chafa-1.12.4/chafa/internal/chafa-work-cell.c   2022-11-12 
02:16:36.000000000 +0100
@@ -111,8 +111,8 @@
     if (sym->bg_weight > 1)
         chafa_color_accum_div_scalar (&accums [0], sym->bg_weight);
 
-    accum_to_color (&accums [1], &color_pair_out->colors 
[CHAFA_COLOR_PAIR_FG]);
     accum_to_color (&accums [0], &color_pair_out->colors 
[CHAFA_COLOR_PAIR_BG]);
+    accum_to_color (&accums [1], &color_pair_out->colors 
[CHAFA_COLOR_PAIR_FG]);
 }
 
 void
@@ -323,8 +323,8 @@
 
     /* Choose two colors by median cut */
 
-    color_pair_out->colors [0] = wcell->pixels [sorted_pixels 
[CHAFA_SYMBOL_N_PIXELS / 4]].col;
-    color_pair_out->colors [1] = wcell->pixels [sorted_pixels 
[(CHAFA_SYMBOL_N_PIXELS * 3) / 4]].col;
+    color_pair_out->colors [CHAFA_COLOR_PAIR_BG] = wcell->pixels 
[sorted_pixels [0]].col;
+    color_pair_out->colors [CHAFA_COLOR_PAIR_FG] = wcell->pixels 
[sorted_pixels [CHAFA_SYMBOL_N_PIXELS - 1]].col;
 }
 
 static const ChafaPixel *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/internal/smolscale/smolscale-avx2.c 
new/chafa-1.12.4/chafa/internal/smolscale/smolscale-avx2.c
--- old/chafa-1.12.3/chafa/internal/smolscale/smolscale-avx2.c  2022-07-01 
01:09:11.000000000 +0200
+++ new/chafa-1.12.4/chafa/internal/smolscale/smolscale-avx2.c  2022-11-12 
02:16:36.000000000 +0100
@@ -1753,6 +1753,19 @@
 
     unpacked_in = vertical_ctx->parts_row [3];
 
+    /* 32-bit unpackers need 32-bit alignment */
+    if ((((uintptr_t) row_in) & 3)
+        && scale_ctx->pixel_type_in != SMOL_PIXEL_RGB8
+        && scale_ctx->pixel_type_in != SMOL_PIXEL_BGR8)
+    {
+        if (!vertical_ctx->in_aligned)
+            vertical_ctx->in_aligned =
+                smol_alloc_aligned (scale_ctx->width_in * sizeof (uint32_t),
+                                    &vertical_ctx->in_aligned_storage);
+        memcpy (vertical_ctx->in_aligned, row_in, scale_ctx->width_in * sizeof 
(uint32_t));
+        row_in = vertical_ctx->in_aligned;
+    }
+
     scale_ctx->unpack_row_func (row_in,
                                 unpacked_in,
                                 scale_ctx->width_in);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/internal/smolscale/smolscale-private.h 
new/chafa-1.12.4/chafa/internal/smolscale/smolscale-private.h
--- old/chafa-1.12.3/chafa/internal/smolscale/smolscale-private.h       
2022-06-20 00:20:07.000000000 +0200
+++ new/chafa-1.12.4/chafa/internal/smolscale/smolscale-private.h       
2022-11-12 02:16:36.000000000 +0100
@@ -110,6 +110,8 @@
     uint32_t in_ofs;
     uint64_t *parts_row [4];
     uint64_t *row_storage [4];
+    uint32_t *in_aligned;
+    uint32_t *in_aligned_storage;
 }
 SmolVerticalCtx;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/internal/smolscale/smolscale.c 
new/chafa-1.12.4/chafa/internal/smolscale/smolscale.c
--- old/chafa-1.12.3/chafa/internal/smolscale/smolscale.c       2022-07-01 
01:09:11.000000000 +0200
+++ new/chafa-1.12.4/chafa/internal/smolscale/smolscale.c       2022-11-12 
02:16:36.000000000 +0100
@@ -1630,6 +1630,19 @@
 
     unpacked_in = vertical_ctx->parts_row [3];
 
+    /* 32-bit unpackers need 32-bit alignment */
+    if ((((uintptr_t) row_in) & 3)
+        && scale_ctx->pixel_type_in != SMOL_PIXEL_RGB8
+        && scale_ctx->pixel_type_in != SMOL_PIXEL_BGR8)
+    {
+        if (!vertical_ctx->in_aligned)
+            vertical_ctx->in_aligned =
+                smol_alloc_aligned (scale_ctx->width_in * sizeof (uint32_t),
+                                    &vertical_ctx->in_aligned_storage);
+        memcpy (vertical_ctx->in_aligned, row_in, scale_ctx->width_in * sizeof 
(uint32_t));
+        row_in = vertical_ctx->in_aligned;
+    }
+
     scale_ctx->unpack_row_func (row_in,
                                 unpacked_in,
                                 scale_ctx->width_in);
@@ -2363,6 +2376,10 @@
     {
         smol_free (vertical_ctx.row_storage [i]);
     }
+
+    /* Used to align row data if needed. May be allocated in 
scale_horizontal(). */
+    if (vertical_ctx.in_aligned)
+        smol_free (vertical_ctx.in_aligned_storage);
 }
 
 /* --- Conversion tables --- */
@@ -2882,12 +2899,12 @@
 static void
 smol_scale_init (SmolScaleCtx *scale_ctx,
                  SmolPixelType pixel_type_in,
-                 const uint32_t *pixels_in,
+                 const void *pixels_in,
                  uint32_t width_in,
                  uint32_t height_in,
                  uint32_t rowstride_in,
                  SmolPixelType pixel_type_out,
-                 uint32_t *pixels_out,
+                 void *pixels_out,
                  uint32_t width_out,
                  uint32_t height_out,
                  uint32_t rowstride_out,
@@ -2968,12 +2985,12 @@
 
 SmolScaleCtx *
 smol_scale_new (SmolPixelType pixel_type_in,
-                const uint32_t *pixels_in,
+                const void *pixels_in,
                 uint32_t width_in,
                 uint32_t height_in,
                 uint32_t rowstride_in,
                 SmolPixelType pixel_type_out,
-                uint32_t *pixels_out,
+                void *pixels_out,
                 uint32_t width_out,
                 uint32_t height_out,
                 uint32_t rowstride_out)
@@ -2999,12 +3016,12 @@
 
 SmolScaleCtx *
 smol_scale_new_full (SmolPixelType pixel_type_in,
-                     const uint32_t *pixels_in,
+                     const void *pixels_in,
                      uint32_t width_in,
                      uint32_t height_in,
                      uint32_t rowstride_in,
                      SmolPixelType pixel_type_out,
-                     uint32_t *pixels_out,
+                     void *pixels_out,
                      uint32_t width_out,
                      uint32_t height_out,
                      uint32_t rowstride_out,
@@ -3039,12 +3056,12 @@
 
 void
 smol_scale_simple (SmolPixelType pixel_type_in,
-                   const uint32_t *pixels_in,
+                   const void *pixels_in,
                    uint32_t width_in,
                    uint32_t height_in,
                    uint32_t rowstride_in,
                    SmolPixelType pixel_type_out,
-                   uint32_t *pixels_out,
+                   void *pixels_out,
                    uint32_t width_out,
                    uint32_t height_out,
                    uint32_t rowstride_out)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa/internal/smolscale/smolscale.h 
new/chafa-1.12.4/chafa/internal/smolscale/smolscale.h
--- old/chafa-1.12.3/chafa/internal/smolscale/smolscale.h       2022-06-20 
00:20:07.000000000 +0200
+++ new/chafa-1.12.4/chafa/internal/smolscale/smolscale.h       2022-11-12 
02:16:36.000000000 +0100
@@ -44,21 +44,21 @@
  * the source memory and an existing allocation to receive the output data.
  * This interface can only be used from a single thread. */
 
-void smol_scale_simple (SmolPixelType pixel_type_in, const uint32_t *pixels_in,
+void smol_scale_simple (SmolPixelType pixel_type_in, const void *pixels_in,
                         uint32_t width_in, uint32_t height_in, uint32_t 
rowstride_in,
-                        SmolPixelType pixel_type_out, uint32_t *pixels_out,
+                        SmolPixelType pixel_type_out, void *pixels_out,
                         uint32_t width_out, uint32_t height_out, uint32_t 
rowstride_out);
 
 /* Batch API: Allows scaling a few rows at a time. Suitable for 
multithreading. */
 
-SmolScaleCtx *smol_scale_new (SmolPixelType pixel_type_in, const uint32_t 
*pixels_in,
+SmolScaleCtx *smol_scale_new (SmolPixelType pixel_type_in, const void 
*pixels_in,
                               uint32_t width_in, uint32_t height_in, uint32_t 
rowstride_in,
-                              SmolPixelType pixel_type_out, uint32_t 
*pixels_out,
+                              SmolPixelType pixel_type_out, void *pixels_out,
                               uint32_t width_out, uint32_t height_out, 
uint32_t rowstride_out);
 
-SmolScaleCtx *smol_scale_new_full (SmolPixelType pixel_type_in, const uint32_t 
*pixels_in,
+SmolScaleCtx *smol_scale_new_full (SmolPixelType pixel_type_in, const void 
*pixels_in,
                                    uint32_t width_in, uint32_t height_in, 
uint32_t rowstride_in,
-                                   SmolPixelType pixel_type_out, uint32_t 
*pixels_out,
+                                   SmolPixelType pixel_type_out, void 
*pixels_out,
                                    uint32_t width_out, uint32_t height_out, 
uint32_t rowstride_out,
                                    SmolPostRowFunc post_row_func, void 
*user_data);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/chafa.pc.in new/chafa-1.12.4/chafa.pc.in
--- old/chafa-1.12.3/chafa.pc.in        2020-03-03 13:08:11.000000000 +0100
+++ new/chafa-1.12.4/chafa.pc.in        2022-11-12 02:16:36.000000000 +0100
@@ -7,5 +7,6 @@
 Description: Image to character art facsimile
 Requires: glib-2.0
 Version: @VERSION@
-Libs: -L${libdir} -lchafa -lm
+Libs: -L${libdir} -lchafa
+Libs.private: -lm
 Cflags: -I${includedir}/chafa -I${libdir}/chafa/include
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/configure.ac new/chafa-1.12.4/configure.ac
--- old/chafa-1.12.3/configure.ac       2022-07-01 01:10:01.000000000 +0200
+++ new/chafa-1.12.4/configure.ac       2022-11-12 02:17:10.000000000 +0100
@@ -6,7 +6,7 @@
 
 m4_define([chafa_major_version], [1])
 m4_define([chafa_minor_version], [12])
-m4_define([chafa_micro_version], [3])
+m4_define([chafa_micro_version], [4])
 
 m4_define([chafa_version], 
[chafa_major_version.chafa_minor_version.chafa_micro_version])
 
@@ -51,7 +51,12 @@
 AC_PROG_CPP
 AC_PROG_INSTALL
 AM_PROG_AR
-LT_INIT
+
+# We keep this obsolete macro around to allow configuration on older systems
+# that require -std=c99, cf. CentOS 7. See github#113.
+AC_PROG_CC_STDC
+
+LT_INIT([win32-dll])
 
 dnl --- Check for extra compiler warnings ---
 
@@ -228,6 +233,24 @@
 AC_CHECK_HEADERS(sys/ioctl.h termios.h windows.h)
 
 dnl
+dnl Define IS_WIN32_BUILD if we're building for Microsoft Windows. In order to
+dnl get UTF-8 support in command-line arguments and environment vars, we need
+dnl to build a resource file with windres and link it in.
+dnl
+
+is_windows_build=no
+case "${host_os}" in
+     cygwin*|mingw*)
+         is_windows_build=yes
+         ;;
+esac
+
+AM_CONDITIONAL([IS_WIN32_BUILD],
+               [test "x$is_windows_build" = "xyes"])
+
+AC_CHECK_TOOL([WINDRES], [windres], [:])
+
+dnl
 dnl Check for -Bsymbolic-functions linker flag used to avoid
 dnl intra-library PLT jumps, if available.
 dnl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/docs/chafa.1 new/chafa-1.12.4/docs/chafa.1
--- old/chafa-1.12.3/docs/chafa.1       2022-07-01 01:13:24.000000000 +0200
+++ new/chafa-1.12.4/docs/chafa.1       2022-11-12 02:23:55.000000000 +0100
@@ -2,7 +2,7 @@
 .\"     Title: chafa
 .\"    Author: Hans Petter Jansson
 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\"      Date: 07/01/2022
+.\"      Date: 11/12/2022
 .\"    Manual: User Commands
 .\"    Source: chafa
 .\"  Language: English
@@ -62,9 +62,11 @@
 .PP
 \fB\-c \fR\fB\fImode\fR\fR\fB, \-\-colors \fR\fB\fImode\fR\fR
 .RS 4
-Set output color mode; one of [none, 2, 8, 16/8 16, 240, 256, full]\&. 
Defaults to full (24\-bit)\&. The 240\-color mode is recommended over the 
256\-color one, since the lower 16 colors are unreliable and tend to differ 
between terminals\&. 16\-color mode will use aixterm extensions to produce 16 
foreground and background colors\&. The 16/8 mode allows for 8 colors plus 
another "bright" 8 colors in the foreground implemented with the "bold" escape 
sequence\&. 2\-color mode will only emit the ANSI codes for reverse color and 
attribute reset, while "none" will emit no escape sequences at all\&.
+Set output color mode; one of [none, 2, 8, 16/8 16, 240, 256, full]\&. The 
240\-color mode is recommended over the 256\-color one, since the lower 16 
colors are unreliable and tend to differ between terminals\&. 16\-color mode 
will use aixterm extensions to produce 16 foreground and background colors\&. 
The 16/8 mode allows for 8 colors plus another "bright" 8 colors in the 
foreground implemented with the "bold" escape sequence\&. 2\-color mode will 
only emit the ANSI codes for reverse color and attribute reset, while "none" 
will emit no escape sequences at all\&.
 .sp
 In sixel mode, "full" will dynamically generate a 256\-color palette for each 
image or animation frame\&. The other modes refer to built\-in palettes\&. 
"none" and "2" are interchangeable and will use the specified 
foreground/background colors (see \-\-fg and \-\-bg)\&.
+.sp
+If left unspecified, an optimal default will be chosen based on the current 
environment\&.
 .RE
 .PP
 \fB\-\-color\-extractor \fR\fB\fIextractor\fR\fR
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/docs/chafa.html new/chafa-1.12.4/docs/chafa.html
--- old/chafa-1.12.3/docs/chafa.html    2022-07-01 01:13:24.000000000 +0200
+++ new/chafa-1.12.4/docs/chafa.html    2022-11-12 02:23:55.000000000 +0100
@@ -20,19 +20,22 @@
 </p></dd><dt><span class="term"><code 
class="option">--clear</code></span></dt><dd><p>
 Clear screen before processing each file.
 </p></dd><dt><span class="term"><code class="option">-c <em 
class="replaceable"><code>mode</code></em>, --colors <em 
class="replaceable"><code>mode</code></em></code></span></dt><dd><p>
-Set output color mode; one of [none, 2, 8, 16/8 16, 240, 256, full]. Defaults
-to full (24-bit). The 240-color mode is recommended over the 256-color one,
-since the lower 16 colors are unreliable and tend to differ between terminals.
-16-color mode will use aixterm extensions to produce 16 foreground and
-background colors. The 16/8 mode allows for 8 colors plus another "bright" 8
-colors in the foreground implemented with the "bold" escape sequence. 2-color
-mode will only emit the ANSI codes for reverse color and attribute reset,
-while "none" will emit no escape sequences at all.
+Set output color mode; one of [none, 2, 8, 16/8 16, 240, 256, full]. The
+240-color mode is recommended over the 256-color one, since the lower 16 colors
+are unreliable and tend to differ between terminals. 16-color mode will use
+aixterm extensions to produce 16 foreground and background colors. The 16/8
+mode allows for 8 colors plus another "bright" 8 colors in the foreground
+implemented with the "bold" escape sequence. 2-color mode will only emit the
+ANSI codes for reverse color and attribute reset, while "none" will emit no
+escape sequences at all.
 </p><p>
 In sixel mode, "full" will dynamically generate a 256-color palette for each
 image or animation frame. The other modes refer to built-in palettes. "none"
 and "2" are interchangeable and will use the specified foreground/background
 colors (see --fg and --bg).
+</p><p>
+If left unspecified, an optimal default will be chosen based on the current
+environment.
 </p></dd><dt><span class="term"><code class="option">--color-extractor <em 
class="replaceable"><code>extractor</code></em></code></span></dt><dd><p>
 Method for extracting color from an area; one of [average, median]. Median
 normally produces crisper output, while average may perform better on noisy 
images.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/docs/chafa.xml new/chafa-1.12.4/docs/chafa.xml
--- old/chafa-1.12.3/docs/chafa.xml     2022-06-20 00:20:07.000000000 +0200
+++ new/chafa-1.12.4/docs/chafa.xml     2022-11-12 02:16:36.000000000 +0100
@@ -85,20 +85,24 @@
 <varlistentry>
 <term><option>-c <replaceable>mode</replaceable>, --colors 
<replaceable>mode</replaceable></option></term>
 <listitem><para>
-Set output color mode; one of [none, 2, 8, 16/8 16, 240, 256, full]. Defaults
-to full (24-bit). The 240-color mode is recommended over the 256-color one,
-since the lower 16 colors are unreliable and tend to differ between terminals.
-16-color mode will use aixterm extensions to produce 16 foreground and
-background colors. The 16/8 mode allows for 8 colors plus another "bright" 8
-colors in the foreground implemented with the "bold" escape sequence. 2-color
-mode will only emit the ANSI codes for reverse color and attribute reset,
-while "none" will emit no escape sequences at all.
+Set output color mode; one of [none, 2, 8, 16/8 16, 240, 256, full]. The
+240-color mode is recommended over the 256-color one, since the lower 16 colors
+are unreliable and tend to differ between terminals. 16-color mode will use
+aixterm extensions to produce 16 foreground and background colors. The 16/8
+mode allows for 8 colors plus another "bright" 8 colors in the foreground
+implemented with the "bold" escape sequence. 2-color mode will only emit the
+ANSI codes for reverse color and attribute reset, while "none" will emit no
+escape sequences at all.
 </para>
 <para>
 In sixel mode, "full" will dynamically generate a 256-color palette for each
 image or animation frame. The other modes refer to built-in palettes. "none"
 and "2" are interchangeable and will use the specified foreground/background
 colors (see --fg and --bg).
+</para>
+<para>
+If left unspecified, an optimal default will be chosen based on the current
+environment.
 </para></listitem>
 </varlistentry>
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/docs/html/index.html new/chafa-1.12.4/docs/html/index.html
--- old/chafa-1.12.3/docs/html/index.html       2022-07-01 01:13:47.000000000 
+0200
+++ new/chafa-1.12.4/docs/html/index.html       2022-11-12 02:24:20.000000000 
+0100
@@ -15,7 +15,7 @@
 <div>
 <div><table class="navigation" id="top" width="100%" cellpadding="2" 
cellspacing="0"><tr><th valign="middle"><p class="title">Chafa Reference 
Manual</p></th></tr></table></div>
 <div><p class="releaseinfo">
-      For Chafa version 1.12.3
+      For Chafa version 1.12.4
 .
       The latest version of this documentation can be found online at
       <a class="ulink" href="https://hpjansson.org/chafa/ref/index.html"; 
target="_top">https://hpjansson.org/chafa/ref/</a>.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/docs/html/style.css new/chafa-1.12.4/docs/html/style.css
--- old/chafa-1.12.3/docs/html/style.css        2022-07-01 01:13:47.000000000 
+0200
+++ new/chafa-1.12.4/docs/html/style.css        2022-11-12 02:24:20.000000000 
+0100
@@ -461,22 +461,22 @@
 td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 
5px; padding-right: 5px; }
 span.linenos.special { color: #000000; background-color: #ffffc0; 
padding-left: 5px; padding-right: 5px; }
 .hll { background-color: #ffffcc }
-.c { color: #408080; font-style: italic } /* Comment */
+.c { color: #3D7B7B; font-style: italic } /* Comment */
 .err { border: 1px solid #FF0000 } /* Error */
 .k { color: #008000; font-weight: bold } /* Keyword */
 .o { color: #666666 } /* Operator */
-.ch { color: #408080; font-style: italic } /* Comment.Hashbang */
-.cm { color: #408080; font-style: italic } /* Comment.Multiline */
-.cp { color: #BC7A00 } /* Comment.Preproc */
-.cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */
-.c1 { color: #408080; font-style: italic } /* Comment.Single */
-.cs { color: #408080; font-style: italic } /* Comment.Special */
+.ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */
+.cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */
+.cp { color: #9C6500 } /* Comment.Preproc */
+.cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */
+.c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */
+.cs { color: #3D7B7B; font-style: italic } /* Comment.Special */
 .gd { color: #A00000 } /* Generic.Deleted */
 .ge { font-style: italic } /* Generic.Emph */
-.gr { color: #FF0000 } /* Generic.Error */
+.gr { color: #E40000 } /* Generic.Error */
 .gh { color: #000080; font-weight: bold } /* Generic.Heading */
-.gi { color: #00A000 } /* Generic.Inserted */
-.go { color: #888888 } /* Generic.Output */
+.gi { color: #008400 } /* Generic.Inserted */
+.go { color: #717171 } /* Generic.Output */
 .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
 .gs { font-weight: bold } /* Generic.Strong */
 .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
@@ -489,15 +489,15 @@
 .kt { color: #B00040 } /* Keyword.Type */
 .m { color: #666666 } /* Literal.Number */
 .s { color: #BA2121 } /* Literal.String */
-.na { color: #7D9029 } /* Name.Attribute */
+.na { color: #687822 } /* Name.Attribute */
 .nb { color: #008000 } /* Name.Builtin */
 .nc { color: #0000FF; font-weight: bold } /* Name.Class */
 .no { color: #880000 } /* Name.Constant */
 .nd { color: #AA22FF } /* Name.Decorator */
-.ni { color: #999999; font-weight: bold } /* Name.Entity */
-.ne { color: #D2413A; font-weight: bold } /* Name.Exception */
+.ni { color: #717171; font-weight: bold } /* Name.Entity */
+.ne { color: #CB3F38; font-weight: bold } /* Name.Exception */
 .nf { color: #0000FF } /* Name.Function */
-.nl { color: #A0A000 } /* Name.Label */
+.nl { color: #767600 } /* Name.Label */
 .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
 .nt { color: #008000; font-weight: bold } /* Name.Tag */
 .nv { color: #19177C } /* Name.Variable */
@@ -514,11 +514,11 @@
 .dl { color: #BA2121 } /* Literal.String.Delimiter */
 .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
 .s2 { color: #BA2121 } /* Literal.String.Double */
-.se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
+.se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */
 .sh { color: #BA2121 } /* Literal.String.Heredoc */
-.si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
+.si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */
 .sx { color: #008000 } /* Literal.String.Other */
-.sr { color: #BB6688 } /* Literal.String.Regex */
+.sr { color: #A45A77 } /* Literal.String.Regex */
 .s1 { color: #BA2121 } /* Literal.String.Single */
 .ss { color: #19177C } /* Literal.String.Symbol */
 .bp { color: #008000 } /* Name.Builtin.Pseudo */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/lodepng/lodepng.c new/chafa-1.12.4/lodepng/lodepng.c
--- old/chafa-1.12.3/lodepng/lodepng.c  2022-07-01 01:09:11.000000000 +0200
+++ new/chafa-1.12.4/lodepng/lodepng.c  2022-11-12 02:16:36.000000000 +0100
@@ -4975,16 +4975,30 @@
       expected_size += lodepng_get_raw_size_idat((*w + 0), (*h + 0) >> 1, bpp);
     }
 
+    if(expected_size > LODEPNG_IMAGE_DATA_SIZE_MAX) {
+      state->error = 114;
+    }
+  }
+
+  if (!state->error) {
     state->error = zlib_decompress(&scanlines, &scanlines_size, expected_size, 
idat, idatsize, &state->decoder.zlibsettings);
   }
+
   if(!state->error && scanlines_size != expected_size) state->error = 91; 
/*decompressed size doesn't match prediction*/
   lodepng_free(idat);
 
   if(!state->error) {
     outsize = lodepng_get_raw_size(*w, *h, &state->info_png.color);
+    if (outsize > LODEPNG_IMAGE_DATA_SIZE_MAX) {
+      state->error = 114;
+    }
+  }
+
+  if(!state->error) {
     *out = (unsigned char*)lodepng_malloc(outsize);
     if(!*out) state->error = 83; /*alloc fail*/
   }
+
   if(!state->error) {
     lodepng_memset(*out, 0, outsize);
     state->error = postProcessScanlines(*out, scanlines, *w, *h, 
&state->info_png);
@@ -6302,6 +6316,8 @@
     /*max ICC size limit can be configured in LodePNGDecoderSettings. This 
error prevents
     unreasonable memory consumption when decoding due to impossibly large ICC 
profile*/
     case 113: return "ICC profile unreasonably large";
+    /*max size of an in-memory image buffer*/
+    case 114: return "image data unreasonably large";
   }
   return "unknown error code";
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/lodepng/lodepng.h new/chafa-1.12.4/lodepng/lodepng.h
--- old/chafa-1.12.3/lodepng/lodepng.h  2022-07-01 01:09:11.000000000 +0200
+++ new/chafa-1.12.4/lodepng/lodepng.h  2022-11-12 02:16:36.000000000 +0100
@@ -30,6 +30,10 @@
 
 extern const char* LODEPNG_VERSION_STRING;
 
+/*Hard upper limit on size of an uncompressed in-memory image buffer. The
+total memory consumption may be higher, e.g. during postProcessScanlines().*/
+#define LODEPNG_IMAGE_DATA_SIZE_MAX 0xffffffffU
+
 /*
 The following #defines are used to create code sections. They can be disabled
 to disable code sections, which can give faster compile time and smaller 
binary.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/tests/Makefile.am new/chafa-1.12.4/tests/Makefile.am
--- old/chafa-1.12.3/tests/Makefile.am  2022-06-20 00:20:07.000000000 +0200
+++ new/chafa-1.12.4/tests/Makefile.am  2022-11-12 02:16:36.000000000 +0100
@@ -40,4 +40,5 @@
 
 EXTRA_DIST = \
        $(TOOL_CHECKS) \
+       chafa-tool-gallery.sh \
        chafa-tool-test-common.sh
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/tests/chafa-tool-gallery.sh 
new/chafa-1.12.4/tests/chafa-tool-gallery.sh
--- old/chafa-1.12.3/tests/chafa-tool-gallery.sh        1970-01-01 
01:00:00.000000000 +0100
+++ new/chafa-1.12.4/tests/chafa-tool-gallery.sh        2022-11-12 
02:16:36.000000000 +0100
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+[ "x${srcdir}" = "x" ] && srcdir="."
+. "${srcdir}/chafa-tool-test-common.sh"
+
+tempdir="${top_builddir}/tests/.temp"
+
+xvfb=$(which Xvfb)
+[ "x${xvfb}" = "x" ] && echo "Missing Xvfb" && exit 1
+
+gterm_name=xfce4-terminal
+gterm=$(which ${gterm_name})
+[ "x${gterm}" = "x" ] && echo "Missing ${gterm_name}" && exit 1
+
+montage=$(which montage)
+[ "x${montage}" = "x" ] && echo "Missing montage" && exit 1
+
+# Terminal parameters
+font='xos4 Terminus 8'
+geometry=60x40
+screen_size=1280x1024
+
+# Chafa parameter lists
+color_modes="tc 240 16 8 2 none"
+color_spaces="rgb din99d"
+color_extractors="average median"
+dither_types="none ordered diffusion"
+symbol_selectors="+0 all wide"
+work_factors="1 5 9"
+
+# Input filename. Must be in data/good/.
+file="taxic.jpg"
+
+function gen_screenshot
+{
+    FNAME="$1"
+
+    echo -- Running -e "bash -c \"${tool} -s ${geometry} -w ${5} -c ${2} 
--symbols ${3} --color-space ${4} \
+${top_srcdir}/tests/data/good/${FNAME} ; sleep 0.5 ; import -window chafa 
out/out-${2}-${3}-${5}-${4}.png -trim\""
+
+    HOME="${tempdir}" XDG_CONFIG_HOME="${HOME}/.config" DISPLAY=:99 ${gterm} \
+        -T chafa \
+        --disable-server \
+        --geometry ${geometry}+0+0 \
+        --font "$font" \
+        --hide-menubar \
+        --hide-toolbar \
+        --hide-borders \
+        --hide-scrollbar \
+        -e "bash -c \"${tool} -s ${geometry} -w ${5} -c ${2} --symbols ${3} 
--color-space ${4} \
+${top_srcdir}/tests/data/good/${FNAME}; sleep 0.5 ; import -window chafa 
${tempdir}/out/${2}-${3}-${5}-${4}.png -trim >/dev/null 2>&1\"" >/dev/null 2>&1
+}
+
+trap "" EXIT SIGQUIT SIGSTOP SIGTERM
+
+# Make sure we don't blow away any old .temp dir
+rm -Rf "${tempdir}/.config"
+rm -Rf "${tempdir}/out"
+rmdir "${tempdir}"
+
+mkdir -p "${tempdir}/out"
+
+mkdir -p ${tempdir}/.config/xfce4/terminal
+cat >${tempdir}/.config/xfce4/terminal/terminalrc <<EOF
+[Configuration]
+MiscAlwaysShowTabs=FALSE
+MiscBell=FALSE
+MiscBellUrgent=FALSE
+MiscBordersDefault=TRUE
+MiscCursorBlinks=TRUE
+MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK
+MiscDefaultGeometry=${geometry}
+MiscInheritGeometry=FALSE
+MiscMenubarDefault=TRUE
+MiscMouseAutohide=FALSE
+MiscMouseWheelZoom=TRUE
+MiscToolbarDefault=FALSE
+MiscConfirmClose=TRUE
+MiscCycleTabs=TRUE
+MiscTabCloseButtons=TRUE
+MiscTabCloseMiddleClick=TRUE
+MiscTabPosition=GTK_POS_TOP
+MiscHighlightUrls=TRUE
+MiscMiddleClickOpensUri=FALSE
+MiscCopyOnSelect=FALSE
+MiscRewrapOnResize=TRUE
+MiscUseShiftArrowsToScroll=FALSE
+MiscSlimTabs=FALSE
+MiscNewTabAdjacent=FALSE
+ScrollingOnOutput=FALSE
+FontName=${font}
+ScrollingBar=TERMINAL_SCROLLBAR_LEFT
+ColorCursorUseDefault=FALSE
+ColorCursorForeground=#000000000000
+ColorCursor=#000000000000
+
+EOF
+
+${xvfb} :99 -ac -screen 0 ${screen_size}x24 >/dev/null 2>&1 &
+XVFB_PID=$!
+
+sleep 2
+
+for cmode in ${color_modes}; do
+    for symbols in ${symbol_selectors}; do
+        for cspace in ${color_spaces}; do
+            for work in ${work_factors}; do
+                gen_screenshot "$file" "$cmode" "$symbols" "$cspace" "$work"
+            done
+        done
+    done
+done
+
+kill ${XVFB_PID}
+
+rm -f "${top_builddir}/tests/chafa-tool-gallery.png"
+${montage} -stroke white -background grey20 -geometry +4+4 -tile 6 -label '%f' 
\
+    "${tempdir}/out/*.png" \
+    "${top_builddir}/tests/chafa-tool-gallery.png"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/tests/data/bad/Makefile.am 
new/chafa-1.12.4/tests/data/bad/Makefile.am
--- old/chafa-1.12.3/tests/data/bad/Makefile.am 2022-06-20 00:20:07.000000000 
+0200
+++ new/chafa-1.12.4/tests/data/bad/Makefile.am 2022-11-12 02:16:36.000000000 
+0100
@@ -1,8 +1,12 @@
 EXTRA_DIST = \
        libnsgif-lzw-oob.gif \
        libnsgif-uninitialized-frame-fields.gif \
+       lodepng-adam7-mystery-over-read.png \
        lodepng-zero-length-literal.png \
+       lodepng-zlib-big-alloc.png \
        no-frame-data.gif \
        pixops-normalize-signed-overflow.gif \
        smolscale-unaligned-1.xwd \
-       smolscale-unaligned-2.xwd
+       smolscale-unaligned-2.xwd \
+       smolscale-unaligned-3.xwd \
+       smolscale-unaligned-4.xwd
Binary files 
old/chafa-1.12.3/tests/data/bad/lodepng-adam7-mystery-over-read.png and 
new/chafa-1.12.4/tests/data/bad/lodepng-adam7-mystery-over-read.png differ
Binary files old/chafa-1.12.3/tests/data/bad/lodepng-zlib-big-alloc.png and 
new/chafa-1.12.4/tests/data/bad/lodepng-zlib-big-alloc.png differ
Binary files old/chafa-1.12.3/tests/data/bad/smolscale-unaligned-3.xwd and 
new/chafa-1.12.4/tests/data/bad/smolscale-unaligned-3.xwd differ
Binary files old/chafa-1.12.3/tests/data/bad/smolscale-unaligned-4.xwd and 
new/chafa-1.12.4/tests/data/bad/smolscale-unaligned-4.xwd differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/tests/data/good/Makefile.am 
new/chafa-1.12.4/tests/data/good/Makefile.am
--- old/chafa-1.12.3/tests/data/good/Makefile.am        2022-06-20 
00:20:07.000000000 +0200
+++ new/chafa-1.12.4/tests/data/good/Makefile.am        2022-11-12 
02:16:36.000000000 +0100
@@ -8,10 +8,12 @@
        noise-32x32-indexed.png \
        noise-32x32.gif \
        noise-32x32.png \
+       noise-32x32.xwd \
        pixel.gif \
        pixel.jpeg \
        pixel.png \
        pixel.svg \
        pixel.tiff \
        pixel.webp \
-       pixel.xwd
+       pixel.xwd \
+       taxic.jpg
Binary files old/chafa-1.12.3/tests/data/good/noise-32x32.xwd and 
new/chafa-1.12.4/tests/data/good/noise-32x32.xwd differ
Binary files old/chafa-1.12.3/tests/data/good/taxic.jpg and 
new/chafa-1.12.4/tests/data/good/taxic.jpg differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/tools/chafa/Makefile.am 
new/chafa-1.12.4/tools/chafa/Makefile.am
--- old/chafa-1.12.3/tools/chafa/Makefile.am    2022-06-20 00:20:07.000000000 
+0200
+++ new/chafa-1.12.4/tools/chafa/Makefile.am    2022-11-12 02:16:36.000000000 
+0100
@@ -60,7 +60,18 @@
 if ENABLE_RPATH
 chafa_LDFLAGS = $(CHAFA_LDFLAGS) -rpath $(libdir)
 endif
-chafa_LDADD = $(GLIB_LIBS) $(MAGICKWAND_LIBS) $(JPEG_LIBS) $(SVG_LIBS) 
$(TIFF_LIBS) $(WEBP_LIBS) $(FREETYPE_LIBS) $(top_builddir)/chafa/libchafa.la 
$(top_builddir)/libnsgif/libnsgif.la $(top_builddir)/lodepng/liblodepng.la
+chafa_LDADD = $(GLIB_LIBS) $(MAGICKWAND_LIBS) $(JPEG_LIBS) $(SVG_LIBS) 
$(TIFF_LIBS) $(WEBP_LIBS) $(FREETYPE_LIBS) $(top_builddir)/chafa/libchafa.la 
$(top_builddir)/libnsgif/libnsgif.la $(top_builddir)/lodepng/liblodepng.la 
$(WIN32_LDADD)
+
+# On Microsoft Windows, we compile a resource file with windres and link it in.
+# This enables UTF-8 support in filenames, environment variables, etc.
+
+if IS_WIN32_BUILD
+WIN32_LDADD = manifest.o
+manifest.o: $(srcdir)/manifest.rc
+       $(WINDRES) -o $@ $(srcdir)/manifest.rc
+else
+WIN32_LDADD =
+endif
 
 endif
 
@@ -73,3 +84,5 @@
        -I$(top_builddir)/chafa \
        -I$(top_srcdir)/libnsgif \
        -I$(top_srcdir)/lodepng
+
+EXTRA_DIST = manifest.rc ms-utf8.xml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/tools/chafa/chafa.c new/chafa-1.12.4/tools/chafa/chafa.c
--- old/chafa-1.12.3/tools/chafa/chafa.c        2022-07-01 01:09:11.000000000 
+0200
+++ new/chafa-1.12.4/tools/chafa/chafa.c        2022-11-12 02:16:36.000000000 
+0100
@@ -36,9 +36,6 @@
 #ifdef HAVE_TERMIOS_H
 # include <termios.h>  /* tcgetattr, tcsetattr */
 #endif
-#ifdef HAVE_WINDOWS_H
-# include <windows.h>
-#endif
 
 #include <glib/gstdio.h>
 
@@ -47,6 +44,14 @@
 #include "media-loader.h"
 #include "named-colors.h"
 
+/* Include after glib.h for G_OS_WIN32 */
+#ifdef G_OS_WIN32
+# ifdef HAVE_WINDOWS_H
+#  include <windows.h>
+# endif
+# include <io.h>
+#endif
+
 #define ANIM_FPS_MAX 100000.0
 #define FILE_DURATION_DEFAULT 0.0
 #define SCALE_MAX 9999.0
@@ -97,6 +102,7 @@
     guint32 bg_color;
     gboolean bg_color_set;
     gdouble transparency_threshold;
+    gboolean transparency_threshold_set;
     gdouble file_duration_s;
 
     /* If > 0.0, override the framerate specified by the input file. */
@@ -126,6 +132,15 @@
 static gboolean using_detected_size = FALSE;
 static volatile sig_atomic_t interrupted_by_user = FALSE;
 
+#ifdef HAVE_TERMIOS_H
+static struct termios saved_termios;
+#endif
+
+#ifdef G_OS_WIN32
+static UINT saved_console_output_cp;
+static UINT saved_console_input_cp;
+#endif
+
 #ifdef HAVE_SIGACTION
 static void
 sigint_handler (G_GNUC_UNUSED int sig)
@@ -393,7 +408,7 @@
     "  -C, --center=BOOL  Center images [on, off]. Defaults to off.\n"
     "      --clear        Clear screen before processing each file.\n"
     "  -c, --colors=MODE  Set output color mode; one of [none, 2, 8, 16/8, 16, 
240,\n"
-    "                     256, full]. Defaults to full (24-bit).\n"
+    "                     256, full]. Defaults to best guess.\n"
     "      --color-extractor=EXTR  Method for extracting color from an area\n"
     "                     [average, median]. Average is the default.\n"
     "      --color-space=CS  Color space used for quantization; one of [rgb, 
din99d].\n"
@@ -1229,15 +1244,6 @@
     *term_size_out = term_size;
 }
 
-#ifdef HAVE_TERMIOS_H
-static struct termios saved_termios;
-#endif
-
-#ifdef G_OS_WIN32
-static UINT saved_console_output_cp;
-static UINT saved_console_input_cp;
-#endif
-
 static void
 tty_options_init (void)
 {
@@ -1637,6 +1643,8 @@
 
     if (options.transparency_threshold == G_MAXDOUBLE)
         options.transparency_threshold = 0.5;
+    else
+        options.transparency_threshold_set = TRUE;
 
     if (options.transparency_threshold < 0.0 || options.transparency_threshold 
> 1.0)
     {
@@ -1827,7 +1835,8 @@
 static GString *
 build_string (ChafaPixelType pixel_type, const guint8 *pixels,
               gint src_width, gint src_height, gint src_rowstride,
-              gint dest_width, gint dest_height)
+              gint dest_width, gint dest_height,
+              gboolean is_animation)
 {
     ChafaCanvasConfig *config;
     ChafaCanvas *canvas;
@@ -1848,8 +1857,13 @@
     chafa_canvas_config_set_preprocessing_enabled (config, options.preprocess);
     chafa_canvas_config_set_fg_only_enabled (config, options.fg_only);
 
-    if (options.transparency_threshold >= 0.0)
+    if (is_animation
+        && options.pixel_mode == CHAFA_PIXEL_MODE_KITTY
+        && !options.transparency_threshold_set)
+        chafa_canvas_config_set_transparency_threshold (config, 1.0f);
+    else if (options.transparency_threshold >= 0.0)
         chafa_canvas_config_set_transparency_threshold (config, 
options.transparency_threshold);
+
     if (options.cell_width > 0 && options.cell_height > 0)
         chafa_canvas_config_set_cell_geometry (config, options.cell_width, 
options.cell_height);
 
@@ -1949,8 +1963,7 @@
         media_loader_goto_first_frame (media_loader);
 
         for (have_frame = TRUE;
-             (is_first_frame || is_animation)
-             && have_frame && !interrupted_by_user && (loop_n == 0 || 
anim_elapsed_s < options.file_duration_s);
+             have_frame && !interrupted_by_user && (loop_n == 0 || 
anim_elapsed_s < options.file_duration_s);
              have_frame = media_loader_goto_next_frame (media_loader))
         {
             gdouble elapsed_ms, remain_ms;
@@ -2005,7 +2018,8 @@
 
             gs = build_string (pixel_type, pixels,
                                src_width, src_height, src_rowstride,
-                               dest_width, dest_height);
+                               dest_width, dest_height,
+                               is_animation);
 
             p0 = buf;
 
@@ -2082,6 +2096,9 @@
             }
 
             is_first_frame = FALSE;
+
+            if (!is_animation)
+                break;
         }
 
         loop_n++;
@@ -2195,6 +2212,11 @@
     sigaction (SIGINT, &sa, NULL);
 #endif
 
+#ifdef G_OS_WIN32
+    setmode (fileno (stdin), O_BINARY);
+    setmode (fileno (stdout), O_BINARY);
+#endif
+
     /* Must do this early. Buffer size probably doesn't matter */
     setvbuf (stdout, NULL, _IOFBF, 32768);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/tools/chafa/file-mapping.c 
new/chafa-1.12.4/tools/chafa/file-mapping.c
--- old/chafa-1.12.3/tools/chafa/file-mapping.c 2022-07-01 01:09:11.000000000 
+0200
+++ new/chafa-1.12.4/tools/chafa/file-mapping.c 2022-11-12 02:16:36.000000000 
+0100
@@ -26,7 +26,11 @@
 #include <sys/stat.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdio.h>
+
+#ifdef G_OS_WIN32
+# include <stdio.h>
+# include <io.h>
+#endif
 
 #ifdef HAVE_MMAP
 # include <sys/mman.h>
@@ -51,9 +55,9 @@
  * flag is not always defined in our cross builds. */
 #ifndef O_BINARY
 # ifdef _O_BINARY
-# define O_BINARY _O_BINARY
+#  define O_BINARY _O_BINARY
 # else
-# define O_BINARY 0
+#  define O_BINARY 0
 # endif
 #endif
 
@@ -82,7 +86,7 @@
     return file_mapping->path
         && file_mapping->path [0] == '-'
         && file_mapping->path [1] == '\0' ? TRUE : FALSE;
- }
+}
 
 static gsize
 safe_read (gint fd, void *buf, gsize len)
@@ -94,6 +98,7 @@
    {
        unsigned int nread;
        int iread;
+       int saved_errno;
 
        /* Passing nread > INT_MAX to read is implementation defined in POSIX
         * 1003.1, therefore despite the unsigned argument portable code must
@@ -105,6 +110,7 @@
            nread = (unsigned int)/*SAFE*/len;
 
        iread = read (fd, buffer, nread);
+       saved_errno = errno;
 
        if (iread == -1)
        {
@@ -112,7 +118,7 @@
             * bytes read because of EINTR, yet it still returns -1 otherwise 
end
             * of file cannot be distinguished.
             */
-           if (errno != EINTR)
+           if (saved_errno != EINTR)
            {
                /* I.e. a permanent failure */
                return 0;
@@ -149,6 +155,7 @@
     {
        guint to_write;
        gint n_written;
+       gint saved_errno;
 
        if (len > INT_MAX)
            to_write = INT_MAX;
@@ -156,10 +163,11 @@
            to_write = (unsigned int) len;
 
        n_written = write (fd, buffer, to_write);
+       saved_errno = errno;
 
        if (n_written == -1)
        {
-           if (errno != EINTR)
+           if (saved_errno != EINTR)
                goto out;
        }
        else if (n_written < 0)
@@ -303,6 +311,10 @@
     if (stdin_fd < 0)
         goto out;
 
+#ifdef G_OS_WIN32
+    setmode (stdin_fd, O_BINARY);
+#endif
+
     /* Read from stdin */
 
     buf = g_malloc (FILE_MEMORY_CACHE_MAX);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/tools/chafa/manifest.rc 
new/chafa-1.12.4/tools/chafa/manifest.rc
--- old/chafa-1.12.3/tools/chafa/manifest.rc    1970-01-01 01:00:00.000000000 
+0100
+++ new/chafa-1.12.4/tools/chafa/manifest.rc    2022-11-12 02:16:36.000000000 
+0100
@@ -0,0 +1,2 @@
+#include <winuser.h>
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "ms-utf8.xml"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/tools/chafa/ms-utf8.xml 
new/chafa-1.12.4/tools/chafa/ms-utf8.xml
--- old/chafa-1.12.3/tools/chafa/ms-utf8.xml    1970-01-01 01:00:00.000000000 
+0100
+++ new/chafa-1.12.4/tools/chafa/ms-utf8.xml    2022-11-12 02:16:36.000000000 
+0100
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
+  <assemblyIdentity type="win32" name="..." version="6.0.0.0"/>
+  <application>
+    <windowsSettings>
+      <activeCodePage 
xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings";>UTF-8</activeCodePage>
+    </windowsSettings>
+  </application>
+</assembly>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/tools/chafa/png-loader.c 
new/chafa-1.12.4/tools/chafa/png-loader.c
--- old/chafa-1.12.3/tools/chafa/png-loader.c   2022-06-20 00:20:07.000000000 
+0200
+++ new/chafa-1.12.4/tools/chafa/png-loader.c   2022-11-12 02:16:36.000000000 
+0100
@@ -33,6 +33,7 @@
 #include "png-loader.h"
 
 #define BYTES_PER_PIXEL 4
+#define IMAGE_BUFFER_SIZE_MAX 0xffffffffU
 
 struct PngLoader
 {
@@ -56,10 +57,13 @@
     gboolean success = FALSE;
     guint width, height;
     unsigned char *frame_data = NULL;
+    LodePNGState lode_state;
     gint lode_error;
 
     g_return_val_if_fail (mapping != NULL, NULL);
 
+    lodepng_state_init (&lode_state);
+
     if (!file_mapping_has_magic (mapping, 0, "\x89PNG", 4))
         goto out;
 
@@ -70,9 +74,14 @@
     if (!loader->file_data)
         goto out;
 
+    lode_state.info_raw.colortype = LCT_RGBA;
+    lode_state.info_raw.bitdepth = 8;
+    lode_state.decoder.zlibsettings.max_output_size = IMAGE_BUFFER_SIZE_MAX;
+
     /* Decodes to RGBA8 */
-    if ((lode_error = lodepng_decode32 (&frame_data, &width, &height,
-                                        loader->file_data, 
loader->file_data_len)) != 0)
+    if ((lode_error = lodepng_decode (&frame_data, &width, &height,
+                                      &lode_state,
+                                      loader->file_data, 
loader->file_data_len)) != 0)
         goto out;
 
     if (width < 1 || width >= (1 << 28)
@@ -98,6 +107,7 @@
             free (frame_data);
     }
 
+    lodepng_state_cleanup (&lode_state);
     return loader;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/chafa-1.12.3/tools/chafa/xwd-loader.c 
new/chafa-1.12.4/tools/chafa/xwd-loader.c
--- old/chafa-1.12.3/tools/chafa/xwd-loader.c   2022-06-20 00:20:07.000000000 
+0200
+++ new/chafa-1.12.4/tools/chafa/xwd-loader.c   2022-11-12 02:16:36.000000000 
+0100
@@ -213,7 +213,7 @@
 
     ASSERT_HEADER (h->header_size >= sizeof (XwdHeader));
     ASSERT_HEADER (h->header_size <= 65535);
-    ASSERT_HEADER (h->header_size % 4 == 0);  /* For image data alignment */
+
     ASSERT_HEADER (h->file_version == 7);
     ASSERT_HEADER (h->pixmap_depth == 24);
 

Reply via email to