projects
/
fairystockfish.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
bc33c7a
)
Skip parsing invalid squares (#599)
author
Fabian Fichter
<ianfab@users.noreply.github.com>
Sun, 19 Mar 2023 19:27:56 +0000 (20:27 +0100)
committer
Fabian Fichter
<ianfab@users.noreply.github.com>
Sun, 19 Mar 2023 19:27:56 +0000 (20:27 +0100)
src/parser.cpp
patch
|
blob
|
history
diff --git
a/src/parser.cpp
b/src/parser.cpp
index
59c22ab
..
28104e7
100644
(file)
--- a/
src/parser.cpp
+++ b/
src/parser.cpp
@@
-115,7
+115,11
@@
namespace {
std::stringstream ss(value);
target = 0;
while (!ss.eof() && ss >> file && ss >> rank)
+ {
+ if (Rank(rank - 1) > RANK_MAX || (file != '*' && File(tolower(file) - 'a') > FILE_MAX))
+ return false;
target |= file == '*' ? rank_bb(Rank(rank - 1)) : square_bb(make_square(File(tolower(file) - 'a'), Rank(rank - 1)));
+ }
return !ss.fail();
}