bug-gnu-chess
[Top][All Lists]
Advanced

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

Bugs in PGNSaveToFile


From: Roland Illig
Subject: Bugs in PGNSaveToFile
Date: Sun, 15 Jul 2018 22:26:06 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Dear GNU Chess developers,

while translating GNU Chess into German, I stumbled upon the
PGNSaveToFile function and noticed some bugs:

* The result of getchar() is saved in a char variable. That variable is
later passed to tolower, resulting in undefined behavior. The variable
type should be int.

* If the input stream ends during "while( getchar() != '\n' )", the
program gets stuck in a CPU-consuming endless loop.

* In that same loop, the parenthesis is placed wrong. This is just a
formatting issue. The formatting in this function is inconsistent in
several other places, too.

* The code explicitly checks for the characters "yn", which only works
well for English. For example, German requires "jn", French requires
"on", Spanish requires "sn". It would be better to use the rpmatch
function instead.

Best,
Roland



reply via email to

[Prev in Thread] Current Thread [Next in Thread]