The upstream maintainer, Simon Thatam, noticed this build problem
and brought a fix in this commit:
    
https://git.tartarus.org/?p=simon/puzzles.git;a=commit;h=907c42bcf0f06826279d5be91be7f7f9c45876d9

Note that it fuzzes with the current 20170606.272beef-1 version
of the package, so I took the liberty to test out the patch here
below.  But I suspect that a better approach would be to upgrade
to the latest version of the Portable Puzzle Collection.

This is yet to be tested on 263-bit int platform.  ;)

_________________________________________________________________
fix-ftbfs-with-gcc-9.patch:

--- a/twiddle.c 2019-12-10 21:28:42.488548074 +0100
+++ b/twiddle.c 2019-12-10 21:29:49.945015261 +0100
@@ -556,6 +556,12 @@
     char *ret, *p, buf[80];
     int i, x, y, col, o, maxlen;

+    /* Pedantic check: ensure buf is large enough to format an int in
+     * decimal, using the bound log10(2) < 1/3. (Obviously in practice
+     * int is not going to be larger than even 32 bits any time soon,
+     * but.) */
+    assert(sizeof(buf) >= 1 + sizeof(int) * CHAR_BIT/3);
+
     /*
      * First work out how many characters we need to display each
      * number. We're pretty flexible on grid contents here, so we
@@ -568,6 +574,11 @@
     }
     o = (state->orientable ? 1 : 0);

+    /* Reassure sprintf-checking compilers like gcc that the field
+     * width we've just computed is not now excessive */
+    if (col >= sizeof(buf))
+        col = sizeof(buf)-1;
+
     /*
      * Now we know the exact total size of the grid we're going to
      * produce: it's got h rows, each containing w lots of col+o,

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to