Hi,

On my macppc machine, i can create an infinite loop just by doing:

  $ qqwing --generate | qqwing --solve

The looped getchar(3) call never reaches EOF on unsigned char archs.

The below diff fixes that issue.

OK?

Charlène.


Index: Makefile
===================================================================
RCS file: /cvs/ports/games/qqwing/Makefile,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 Makefile
--- Makefile    12 Jul 2019 20:46:23 -0000      1.3
+++ Makefile    24 Jul 2021 14:38:21 -0000
@@ -3,7 +3,7 @@
 COMMENT =      Sudoku generator and solver
 DISTNAME =     qqwing-1.3.4
 SHARED_LIBS +=  qqwing                    0.0 # 3.0
-REVISION =     0
+REVISION =     1
 
 CATEGORIES =   games
 
Index: patches/patch-main_cpp
===================================================================
RCS file: patches/patch-main_cpp
diff -N patches/patch-main_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-main_cpp      24 Jul 2021 14:38:21 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Fix infinite loop while using `qqwing --solve` on unsigned char archs (powerpc
+and arm)
+
+Index: main.cpp
+--- main.cpp.orig
++++ main.cpp
+@@ -488,7 +488,7 @@ void printHelp(){
+ bool readPuzzleFromStdIn(int* puzzle){
+       int read = 0;
+       while (read < BOARD_SIZE){
+-              char c = getchar();
++              int c = getchar();
+               if (c == EOF) return false;
+               if (c >= '1' && c <='9'){
+                       puzzle[read] = c-'0';



Reply via email to