if (count[WQ] > 1) n1 += count[WQ]-1; //queensUri, you should make a list, and post it here. The above, and the 3 directions are case, I don't check in Yace (it shouldn't hurt Yace either), but I think it could be worthwhile, to at least give a warning. I check (now ...) the other mentioned things. King not to move in check, exactly 2 Ks of opposite color, number of pieces per side 2) n1 += count[WR]-2; //rooksI can add that attacking the king by a knight and another piece at distance 1 also should not be accepted and it includes the case of attacking the king by a knight and a pawn.
Regards,
Dieter
see my reply to Dieter for, I think, a simpler approach to piece counts. Also:Added a check to validate_piece_placement():
char *validate_piece_placement(char *s)
{
int i = 0;
char *mess = "";
while (legality[i].c) {
int count = counts(s, legality[i].c);
if (count < legality[i].min_allowed || count > legality[i].max_allowed) {
mess = legality[i].message;
return mess;
}
i++;
}
int white_pieces = counts(s, 'P') + counts(s, 'B') + counts(s, 'N') + counts(s, 'R') + counts(s, 'Q') + counts(s, 'K');
if (white_pieces > 16) return "ERROR: Count of white chessmen > 16";
int black_pieces = counts(s, 'p') + counts(s, 'b') + counts(s, 'n') + counts(s, 'r') + counts(s, 'q') + counts(s, 'k');
if (black_pieces > 16) return "ERROR: Count of black chessmen > 16";
}
>char  *validate_piece_placement(char *s)Added a check to validate_piece_placement():
Perhaps, one also wants to confirm that count[WP] if (count[WN] > 2) n1 += count[WN]-2; //(excess) knightsanother way to check the 16, 9, & 10 limits:
n1 = count[WP]; //white pawns
if (count[WB] > 2) n1 += count[WB]-2; //bishops
if (count[WR] > 2) n1 += count[WR]-2; //rooks
if (count[WQ] > 1) n1 += count[WQ]-1; //queens
if (n1 > 8) {
printf("Max 8 pawns plus promoted pieces");
return (error_value);
}
Perhaps, one also wants to confirm that count[WP] > if (count[WN] > 2) n1 += count[WN]-2; //(excess) knightsanother way to check the 16, 9, & 10 limits:
n1 = count[WP]; //white pawns
if (count[WB] > 2) n1 += count[WB]-2; //bishops
if (count[WR] > 2) n1 += count[WR]-2; //rooks
if (count[WQ] > 1) n1 += count[WQ]-1; //queens
if (n1 > 8) {
printf("Max 8 pawns plus promoted pieces");
return (error_value);
}
Thanks. THis is actually much more elegant and even much more general than what I am doing. (But it wouldn't really matter for my engine, 1 K and Regards,
Dieter
I only see this ways to hack:It is time that chess programmers stop supporting viruses and somebody needs to do the first step.
Thus 0,1% of all Windows Programs are "Hello World" Programs?So we have to remove the 99.9% of all Windows programs because they all crash occasionaly!
Hi Uri,Movei can crash if you give it an illegal FEN or long games of more than 1000 moves.
After Dann Corbit's post that it is not acceptable I decided to ask Leo to remove it from his site.
I suggest also other programmers that their program suffers from the same problem to do the same and stop do their program freeware(I believe that most of the chess programs suffer from the same problem).
It is time that chess programmers stop supporting viruses and somebody needs to do the first step.
I may release a new version but it will not be in the near future because
I expect fixing the problem of illegal FEN to not be an easy task and in the near future I care more about improving the strength of the program.
Uri
I don't understand what this is all about but it's obviously not about illegal FEN strings.Movei can crash if you give it an illegal FEN or long games of more than 1000 moves.
After Dann Corbit's post that it is not acceptable I decided to ask Leo to remove it from his site.
I suggest also other programmers that their program suffers from the same problem to do the same and stop do their program freeware(I believe that most of the chess programs suffer from the same problem).
It is time that chess programmers stop supporting viruses and somebody needs to do the first step.
I may release a new version but it will not be in the near future because
I expect fixing the problem of illegal FEN to not be an easy task and in the near future I care more about improving the strength of the program.
Uri
You are right, of course, and I stand corrected. In German we would say "Ich saß auf der Leitung", but I cannot translate it idiomatically. (Literal: "I was sitting on the wire")Perhaps, one also wants to confirm that count[WP] it confirms count[WP] 8 no matter what the other piece counts are.another way to check the 16, 9, & 10 limits:
n1 = count[WP]; //white pawns
Nobody. But if you know of memory overwrite bugs in your program you are guilty of criminal negligence, in my view.I don't understand what this is all about but it's obviously not about illegal FEN strings.Movei can crash if you give it an illegal FEN or long games of more than 1000 moves.
After Dann Corbit's post that it is not acceptable I decided to ask Leo to remove it from his site.
I suggest also other programmers that their program suffers from the same problem to do the same and stop do their program freeware(I believe that most of the chess programs suffer from the same problem).
It is time that chess programmers stop supporting viruses and somebody needs to do the first step.
I may release a new version but it will not be in the near future because
I expect fixing the problem of illegal FEN to not be an easy task and in the near future I care more about improving the strength of the program.
Uri
Who can gurantee bug-free code?
Why should freeware be of better quality than commercials?
>>char           *validate_piece_placement(char *s)What will your function return, when everything is ok? Perhaps you wanted to have a return mess at the end? return type of const char * would be better. The caller must not change the returned value (it could be in read only memory). Sounds pedantic? Sure! I wanted to be pedanticAdded a check to validate_piece_placement():I think, one can easily code small bugs. If we code for fun, and do not code really safty critical apps, we should not be too worried (but it is of course good to be aware of problems, and in general it is obviously good to avoid crashes and buffer overruns).
Regards,
Dieter
In English if we overlook the obvious or can't find something right in front of us, it's "If it had been a snake it would have bit me."You are right, of course, and I stand corrected. In German we would say "Ich saß auf der Leitung", but I cannot translate it idiomatically. (Literal: "I was sitting on the wire")Perhaps, one also wants to confirm that count[WP] >it confirms count[WP] 8 no matter what the other piece counts are.another way to check the 16, 9, & 10 limits:
n1 = count[WP]; //white pawns
Regards,
Dieter
I agree completely. In the crash, there is only a microscopic possibility of damage. And with protected operating systems like NT, it becomes infinitesimal unless there is a carefully engineered (intentional) exploit.I only see this ways to hack:It is time that chess programmers stop supporting viruses and somebody needs to do the first step.
1.- A modified (trojan) winboard or arena or anything similar. But if hackers modified winboard they already have the control so it's useless to hack using your engine.
2.- A modified chess server who sends commands with bad code attached to the FEN position (buffer overrun) in conjunction with a client without verifications.
3.- Downloading FEN positions with bad code attached, again, using buffer overrun, and again with a not too secure client.
So as i can see, the real security problem are not crashes, but buffer overrun holes that IMHO are very dificult to explode (on chess engines).
It's not to complicated to avoid buffer overrun in winboard engines, ie. using fgets() function instead of gets(), in order to indicate buffer max length.
I think it's much more unsecure to download the latest new and untested chess engine (we all do) that can be a trojan or have a virus .
Why suddenly all this emphasis on memory overwrite bugs, what makes them criminal?Nobody. But if you know of memory overwrite bugs in your program you are guilty of criminal negligence, in my view.I don't understand what this is all about but it's obviously not about illegal FEN strings.Movei can crash if you give it an illegal FEN or long games of more than 1000 moves.
After Dann Corbit's post that it is not acceptable I decided to ask Leo to remove it from his site.
I suggest also other programmers that their program suffers from the same problem to do the same and stop do their program freeware(I believe that most of the chess programs suffer from the same problem).
It is time that chess programmers stop supporting viruses and somebody needs to do the first step.
I may release a new version but it will not be in the near future because
I expect fixing the problem of illegal FEN to not be an easy task and in the near future I care more about improving the strength of the program.
Uri
Who can gurantee bug-free code?
Why should freeware be of better quality than commercials?
Every programmer should program in a responsible manner. I can sell a car without an emergency brake and not tell the potential buyer. After all, how often does one really need an emergency brake? But if in the one time in 1 million his family goes off the cliff into the ravine, it is my fault that it happened.
It is not difficult to code carefully and defensively. The routine I wrote that carefully examines the input took about an hour. In the grand scheme of writing a chess program, that is a tiny fraction of the real time that is needed. There are not many places that overwrites can occur. It does not take some stupendous effort to fix them.
A dangling pointer or a bad pointer reference is likely to cause a crash, of course. However, interfaces to the outside world are where exploits come from. So any place where you receive data from an external source is a likely spot to examine for problems. And it is not hard to make a very dangerous program become a very safe one.Why suddenly all this emphasis on memory overwrite bugs, what makes them criminal?Nobody. But if you know of memory overwrite bugs in your program you are guilty of criminal negligence, in my view.I don't understand what this is all about but it's obviously not about illegal FEN strings.Movei can crash if you give it an illegal FEN or long games of more than 1000 moves.
After Dann Corbit's post that it is not acceptable I decided to ask Leo to remove it from his site.
I suggest also other programmers that their program suffers from the same problem to do the same and stop do their program freeware(I believe that most of the chess programs suffer from the same problem).
It is time that chess programmers stop supporting viruses and somebody needs to do the first step.
I may release a new version but it will not be in the near future because
I expect fixing the problem of illegal FEN to not be an easy task and in the near future I care more about improving the strength of the program.
Uri
Who can gurantee bug-free code?
Why should freeware be of better quality than commercials?
Every programmer should program in a responsible manner. I can sell a car without an emergency brake and not tell the potential buyer. After all, how often does one really need an emergency brake? But if in the one time in 1 million his family goes off the cliff into the ravine, it is my fault that it happened.
It is not difficult to code carefully and defensively. The routine I wrote that carefully examines the input took about an hour. In the grand scheme of writing a chess program, that is a tiny fraction of the real time that is needed. There are not many places that overwrites can occur. It does not take some stupendous effort to fix them.
Is it only memory bugs?
I probably lack some information...
I hope I'll never go off the cliff due to a Beowulf bug...
Every pointer can cause this, right?
This attitude is the reason why billions of dollars of damage are done each year by virus and worm attacks. It is not a difficult effort to harden your program against simple attacks. It is irresponsible not to do it.Hi Uri,Movei can crash if you give it an illegal FEN or long games of more than 1000 moves.
After Dann Corbit's post that it is not acceptable I decided to ask Leo to remove it from his site.
I suggest also other programmers that their program suffers from the same problem to do the same and stop do their program freeware(I believe that most of the chess programs suffer from the same problem).
It is time that chess programmers stop supporting viruses and somebody needs to do the first step.
I may release a new version but it will not be in the near future because
I expect fixing the problem of illegal FEN to not be an easy task and in the near future I care more about improving the strength of the program.
Uri
this sounds like an overreaction to me. My BigLion has obvious nuisances,
for example:
1) log files cannot be switched off.
2) resign, but no resign offer.
3) Zero hash size is changed to 1 MB Hash.
4) wrong FEN can lead to crash.
5) 1000 moves causes premature exit.
6) fixed time per move not supported, or buggy.
7) fixed depth search not implemented.
8) ... etc.
However, if someone tells me to stop offering it for download,
I will use words against him which will force any moderator to step in quickly.
Ignore Dann and leave Movei on Leo's homepage, for the sake of thousands of
Movei fans worldwide.
Yes a do have an antivirus, and a firewall, but this it's useless with new threats. I mean that if i wanted to make some damage, i could make a special chess engine version, and announce it as a new 2400 ELO engine (to catch you), and add it code to erase your files on your documents folder and when you download it and execute it your antivirus it's not going to reconize anything, and you are going to lose your documents.Don't you have a virus scanner? Everything written to my disk is checked automatically, and my virus software is updated nightly over the internet.
I suppose that might work. I don't load new chess engines unless I have the source code or they have been around for a while. I also run strings against the binaries to see what is lurking inside and also to see if the program is a clone.Yes a do have an antivirus, and a firewall, but this it's useless with new threats. I mean that if i wanted to make some damage, i could make a special chess engine version, and announce it as a new 2400 ELO engine (to catch you), and add it code to erase your files on your documents folder and when you download it and execute it your antivirus it's not going to reconize anything, and you are going to lose your documents.Don't you have a virus scanner? Everything written to my disk is checked automatically, and my virus software is updated nightly over the internet.
This it's just a sample, maybe you have a very secure environment, but the fact it's that most people would fall in the trap.
Return to Archive (Old Parsimony Forum)
Users browsing this forum: No registered users and 42 guests