Let's Play a Game
The authors of the PVS-Studio analyzer invite you to test your attentiveness.
Code analyzers never get tired and can find errors a human's eye cannot easily notice. We have picked a few code fragments with errors revealed by PVS-Studio, all the fragments taken from well-known open-source projects.
We invite you to take part in a competition against code analyzers to test your agility by trying to find the errors by yourself. You will be offered 15 randomly selected tasks. Every correct answer earns you one score if you give it within 60 seconds. The code fragments are short and 60 seconds is a fair limit.
Let's examine a couple of examples with errors for you to understand how to give the answer.
Example one. You see the following code:
The programmer has made a typo and written index 3 instead of 2. When moving the cursor above the code, various words and numbers will be highlighted. You should point the cursor at number 3 and click the left mouse button.
That will be the right answer.
Example two. It's not always possible to give one definite answer:
The buffer size is to be compared to number 48. The programmer accidentally wrote an excess sizeof() operator, which will result in comparing the buffer size to the size of the int type.
In my opinion, it is the "sizeof" operator which is a mistake here and this is the word you should point the mouse at. However, without knowing the complete program text, one may go another way in one's thinking: the 'sizeof' operator was to calculate the size of some buffer but was mistakenly fed a macro. The error then is in "SSL3_MASTER_SECRET_LENGTH".
For cases like this, both answers (whether "sizeof" or "SSL3_MASTER_SECRET_LENGTH") will count as correct.
Good luck. Start game.
P.S. We understand that the tasks are not perfect; it's not always clear where exactly you should <br />"hit" with the mouse, and the system can be cheated. Just remember that this site section was created purely for fun's sake, not for detailed and reliable testing of someone's abilities.
|Vote for this post
Bring it to the Main Page