Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
Let's Play a Game

Let's Play a Game

Sep 18 2014
Author:

The authors of the PVS-Studio analyzer invite you to test your attentiveness.

0280_Play_a_Game/image1.png

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:

0280_Play_a_Game/image2.png

The error here is marked red, but there won't be any marking for you when solving tasks, of course.

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:

0280_Play_a_Game/image3.png

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 the game.

P.S. We understand that the tasks are not perfect; it's not always clear where exactly you should

"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.

Popular related articles


Comments (0)

Next comments next comments
close comment form
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam