SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
Analyzing the Quake III Arena GPL
project
Author: Andrey Karpov
Date: 06.02.2012
As you know, the id Software company has laid out source codes of many of their games. We already
checked some of these projects earlier. This time we decided to analyze the Quake III Arena GPL source
code. Analysis was performed with PVS-Studio 4.54.
Unfortunately, the post about the check appeared to be bare and without detailed comments. We
haven't found such errors in Quake III Arena GPL as to write an interesting article about. Moreover,
some of the found errors we have already seen when checking the Doom 3 game's code.
Below we will cite code fragments with various errors and corresponding diagnostic messages that
helped us to find them. As usually, we want to note that these are far not all the errors the PVS-Studio
analyzer can detect in this project:
• If an error is found several times, only one case is described.
• The article does not contain descriptions of unessential errors.
• We do not cite code fragments about which we cannot decide quickly whether or not there is an
error.
Readers can study diagnostic messages generated by PVS-Studio themselves if they wish. The new trial
mode allows you to do that easily.
Fragment N1.
Diagnostic message V511.
The sizeof() operator returns size of the pointer, and not of the array, in 'sizeof(src)' expression.
ID_INLINE mat3_t::mat3_t( float src[ 3 ][ 3 ] ) {
memcpy( mat, src, sizeof( src ) );
}
Correct code:
memcpy( mat, src, sizeof(float) * 3 * 3);
Fragment N2.
Diagnostic message V501.
There are identical sub-expressions '(result->flags & 64)' to the left and to the right of the '||' operator.
void BotMoveToGoal(....)
{
...
if ((result->flags & MOVERESULT_ONTOPOF_FUNCBOB) ||
(result->flags & MOVERESULT_ONTOPOF_FUNCBOB))
{
ms->reachability_time = AAS_Time() + 5;
}
...
}
Fragment N3.
Diagnostic message V510.
The 'ScriptError' function is not expected to receive class-type variable as third actual argument.
typedef struct punctuation_s
{
char *p;
int n;
struct punctuation_s *next;
} punctuation_t;
punctuation_t *punctuations;
int PS_ExpectTokenType(script_t *script, ....)
{
...
ScriptError(script, "expected %s, found %s",
script->punctuations[subtype], token->string);
...
}
Fragment N4.
Diagnostic message V570.
The 'p->org[0]' variable is assigned to itself.
void CG_ParticleSnowFlurry (qhandle_t pshader, centity_t *cent)
{
...
p->org[0] = p->org[0];
p->org[1] = p->org[1];
p->org[2] = p->org[2];
...
}
Fragment N5.
Diagnostic message V568.
It's odd that the argument of sizeof() operator is the '& itemInfo' expression.
void CG_RegisterItemVisuals( int itemNum ) {
itemInfo_t *itemInfo;
...
memset( itemInfo, 0, sizeof( &itemInfo ) );
}
Correct code:
memset( itemInfo, 0, sizeof( *itemInfo ) );
Fragment N6.
Diagnostic message V595.
The 'item' pointer was utilized before it was verified against nullptr. Check lines: 3865, 3869.
void Item_Paint(itemDef_t *item) {
vec4_t red;
menuDef_t *parent = (menuDef_t*)item->parent;
red[0] = red[3] = 1;
red[1] = red[2] = 0;
if (item == NULL) {
return;
}
...
}
Fragment N7.
Diagnostic message V557.
Array overrun is possible. The 'sizeof (bs->teamleader)' index is pointing beyond array bound.
typedef struct bot_activategoal_s
{
...
float leadbackup_time;
char teamleader[32];
float askteamleader_time;
...
} bot_state_t;
void BotTeamAI(bot_state_t *bs) {
...
bs->teamleader[sizeof(bs->teamleader)] = '0';
...
}
Fragment N8.
Diagnostic message V579.
The Com_Memset function receives the pointer and its size as arguments. It is possibly a mistake.
Inspect the third argument.
void Cvar_Restart_f( void ) {
cvar_t *var;
...
// clear the var completely, since we
// can't remove the index from the list
Com_Memset( var, 0, sizeof( var ) );
...
}
Correct code:
Com_Memset( var, 0, sizeof( *var ) );
Fragment N9.
Diagnostic message V557.
Array overrun is possible. The '3' index is pointing beyond array bound.
void RB_CalcColorFromOneMinusEntity( unsigned char *dstColors )
{
int *pColors = ( int * ) dstColors;
unsigned char invModulate[3];
int c;
...
invModulate[0]=255-backEnd.currentEntity->e.shaderRGBA[0];
invModulate[1]=255-backEnd.currentEntity->e.shaderRGBA[1];
invModulate[2]=255-backEnd.currentEntity->e.shaderRGBA[2];
invModulate[3]=255-backEnd.currentEntity->e.shaderRGBA[3];
...
}
Fragment N10.
Diagnostic message V521.
Such expressions using the ',' operator are dangerous. Make sure the expression is correct.
void Q1_AllocMaxBSP(void)
{
...
q1_allocatedbspmem +=
Q1_MAX_MAP_CLIPNODES * sizeof(q1_dclipnode_t);
...
q1_allocatedbspmem +=
Q1_MAX_MAP_EDGES , sizeof(q1_dedge_t);
...
q1_allocatedbspmem +=
Q1_MAX_MAP_MARKSURFACES * sizeof(unsigned short);
...
}
Correct code:
Q1_MAX_MAP_EDGES * sizeof(q1_dedge_t);
Fragment N11.
Diagnostic message V595.
The 'node' pointer was utilized before it was verified against nullptr. Check lines: 769, 770.
void FloodPortals_r (node_t *node, int dist)
{
...
if (node->occupied)
Error("FloodPortals_r: node already occupiedn");
if (!node)
{
Error("FloodPortals_r: NULL noden");
}
...
}
Fragment N12.
Diagnostic message V501.
There are identical sub-expressions 'fabs(dir[1]) > test->radius' to the left and to the right of the '||'
operator.
int VL_FindAdjacentSurface(....)
{
...
if (fabs(dir[0]) > test->radius ||
fabs(dir[1]) > test->radius ||
fabs(dir[1]) > test->radius)
{
...
}
Fragment N13.
Diagnostic message V517.
The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence.
Check lines: 3333, 3335.
void CMainFrame::OnClipSelected()
{
...
if (g_bPatchBendMode)
Patch_BendHandleENTER();
else if (g_bPatchBendMode)
Patch_InsDelHandleENTER();
...
}
Fragment N14.
Diagnostic message V579.
The memset function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the
third argument.
void CXYWnd::Paste()
{
...
char* pBuffer = new char[nLen+1];
memset( pBuffer, 0, sizeof(pBuffer) );
...
}
Correct code:
memset( pBuffer, 0, (nLen+1) * sizeof(char) );
Fragment N15.
Diagnostic message V519.
The 'numQuadCels' variable is assigned values twice successively. Perhaps this is a mistake. Check lines:
1004, 1006.
static void setupQuad( long xOff, long yOff )
{
...
numQuadCels = (.....);
numQuadCels += numQuadCels/4 + numQuadCels/16;
numQuadCels += 64;
numQuadCels = (.....);
numQuadCels += numQuadCels/4;
numQuadCels += 64;
...
}
Fragment N16.
Diagnostic message V537.
Consider reviewing the correctness of 'scale_x' item's usage.
void Terrain_AddMovePoint(....) {
...
x = ( v[ 0 ] - p->origin[ 0 ] ) / p->scale_x;
y = ( v[ 1 ] - p->origin[ 1 ] ) / p->scale_x;
...
}
Correct code:
y = ( v[ 1 ] - p->origin[ 1 ] ) / p->scale_y;
Fragment N17.
Diagnostic message V557.
Array overrun is possible. The value of 'i' index could reach 3.
int numteamVotingClients[2];
void CalculateRanks( void ) {
...
for ( i = 0; i < TEAM_NUM_TEAMS; i++ ) {
level.numteamVotingClients[i] = 0;
}
...
}
Fragment N18.
Diagnostic message V591.
Non-void function should return a value.
static ID_INLINE int BigLong(int l)
{ LongSwap(l); }
Correct code:
static ID_INLINE int BigLong(int l)
{ return LongSwap(l); }
Conclusion
It took me about three hours to find all these errors. This time includes downloading the source codes,
the analysis itself, analyzing the results and copying out the most interesting code fragments. As you
see, a static analyzer is a very efficient tool of error search. However, it is even more efficient when used
regularly.

Contenu connexe

Tendances

Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionAndrey Karpov
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionPVS-Studio
 
Mathematicians: Trust, but Verify
Mathematicians: Trust, but VerifyMathematicians: Trust, but Verify
Mathematicians: Trust, but VerifyAndrey Karpov
 
(5) cpp dynamic memory_arrays_and_c-strings
(5) cpp dynamic memory_arrays_and_c-strings(5) cpp dynamic memory_arrays_and_c-strings
(5) cpp dynamic memory_arrays_and_c-stringsNico Ludwig
 
How to make fewer errors at the stage of code writing. Part N4.
How to make fewer errors at the stage of code writing. Part N4.How to make fewer errors at the stage of code writing. Part N4.
How to make fewer errors at the stage of code writing. Part N4.PVS-Studio
 
"Why is there no artificial intelligence yet?" Or, analysis of CNTK tool kit ...
"Why is there no artificial intelligence yet?" Or, analysis of CNTK tool kit ..."Why is there no artificial intelligence yet?" Or, analysis of CNTK tool kit ...
"Why is there no artificial intelligence yet?" Or, analysis of CNTK tool kit ...PVS-Studio
 
Lesson 17. Pattern 9. Mixed arithmetic
Lesson 17. Pattern 9. Mixed arithmeticLesson 17. Pattern 9. Mixed arithmetic
Lesson 17. Pattern 9. Mixed arithmeticPVS-Studio
 
Checking the Source Code of FlashDevelop with PVS-Studio
Checking the Source Code of FlashDevelop with PVS-StudioChecking the Source Code of FlashDevelop with PVS-Studio
Checking the Source Code of FlashDevelop with PVS-StudioPVS-Studio
 
A Slipshod Check of the Visual C++ 2013 Library (update 3)
A Slipshod Check of the Visual C++ 2013 Library (update 3)A Slipshod Check of the Visual C++ 2013 Library (update 3)
A Slipshod Check of the Visual C++ 2013 Library (update 3)Andrey Karpov
 
Asterisk: PVS-Studio Takes Up Telephony
Asterisk: PVS-Studio Takes Up TelephonyAsterisk: PVS-Studio Takes Up Telephony
Asterisk: PVS-Studio Takes Up TelephonyAndrey Karpov
 
Explanations to the article on Copy-Paste
Explanations to the article on Copy-PasteExplanations to the article on Copy-Paste
Explanations to the article on Copy-PastePVS-Studio
 
Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)Geeks Anonymes
 
Lab. Programs in C
Lab. Programs in CLab. Programs in C
Lab. Programs in CSaket Pathak
 
Solid C++ by Example
Solid C++ by ExampleSolid C++ by Example
Solid C++ by ExampleOlve Maudal
 
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays 2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays kinan keshkeh
 

Tendances (20)

Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correction
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correction
 
Mathematicians: Trust, but Verify
Mathematicians: Trust, but VerifyMathematicians: Trust, but Verify
Mathematicians: Trust, but Verify
 
(5) cpp dynamic memory_arrays_and_c-strings
(5) cpp dynamic memory_arrays_and_c-strings(5) cpp dynamic memory_arrays_and_c-strings
(5) cpp dynamic memory_arrays_and_c-strings
 
How to make fewer errors at the stage of code writing. Part N4.
How to make fewer errors at the stage of code writing. Part N4.How to make fewer errors at the stage of code writing. Part N4.
How to make fewer errors at the stage of code writing. Part N4.
 
C++11 & C++14
C++11 & C++14C++11 & C++14
C++11 & C++14
 
"Why is there no artificial intelligence yet?" Or, analysis of CNTK tool kit ...
"Why is there no artificial intelligence yet?" Or, analysis of CNTK tool kit ..."Why is there no artificial intelligence yet?" Or, analysis of CNTK tool kit ...
"Why is there no artificial intelligence yet?" Or, analysis of CNTK tool kit ...
 
Lesson 17. Pattern 9. Mixed arithmetic
Lesson 17. Pattern 9. Mixed arithmeticLesson 17. Pattern 9. Mixed arithmetic
Lesson 17. Pattern 9. Mixed arithmetic
 
C++11
C++11C++11
C++11
 
Checking the Source Code of FlashDevelop with PVS-Studio
Checking the Source Code of FlashDevelop with PVS-StudioChecking the Source Code of FlashDevelop with PVS-Studio
Checking the Source Code of FlashDevelop with PVS-Studio
 
A Slipshod Check of the Visual C++ 2013 Library (update 3)
A Slipshod Check of the Visual C++ 2013 Library (update 3)A Slipshod Check of the Visual C++ 2013 Library (update 3)
A Slipshod Check of the Visual C++ 2013 Library (update 3)
 
Modern C++
Modern C++Modern C++
Modern C++
 
Asterisk: PVS-Studio Takes Up Telephony
Asterisk: PVS-Studio Takes Up TelephonyAsterisk: PVS-Studio Takes Up Telephony
Asterisk: PVS-Studio Takes Up Telephony
 
Explanations to the article on Copy-Paste
Explanations to the article on Copy-PasteExplanations to the article on Copy-Paste
Explanations to the article on Copy-Paste
 
Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)
 
Lab. Programs in C
Lab. Programs in CLab. Programs in C
Lab. Programs in C
 
Solid C++ by Example
Solid C++ by ExampleSolid C++ by Example
Solid C++ by Example
 
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays 2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
 
OpenGL ES 3 Reference Card
OpenGL ES 3 Reference CardOpenGL ES 3 Reference Card
OpenGL ES 3 Reference Card
 
C operators
C operatorsC operators
C operators
 

En vedette

Analyzing the Blender project with PVS-Studio
Analyzing the Blender project with PVS-StudioAnalyzing the Blender project with PVS-Studio
Analyzing the Blender project with PVS-StudioPVS-Studio
 
Wade not in unknown waters. Part two.
Wade not in unknown waters. Part two.Wade not in unknown waters. Part two.
Wade not in unknown waters. Part two.PVS-Studio
 
PVS-Studio vs Clang
PVS-Studio vs ClangPVS-Studio vs Clang
PVS-Studio vs ClangPVS-Studio
 
Reanalyzing the Notepad++ project
Reanalyzing the Notepad++ projectReanalyzing the Notepad++ project
Reanalyzing the Notepad++ projectPVS-Studio
 
I want to sell a PVS-Studio license to the Intel company
I want to sell a PVS-Studio license to the Intel companyI want to sell a PVS-Studio license to the Intel company
I want to sell a PVS-Studio license to the Intel companyPVS-Studio
 
Introduction into 64 bits for the beginners or where's again the 64-bit world?
Introduction into 64 bits for the beginners or where's again the 64-bit world?Introduction into 64 bits for the beginners or where's again the 64-bit world?
Introduction into 64 bits for the beginners or where's again the 64-bit world?PVS-Studio
 
How we test the code analyzer
How we test the code analyzerHow we test the code analyzer
How we test the code analyzerPVS-Studio
 
Comparing capabilities of PVS-Studio and Visual Studio 2010 in detecting defe...
Comparing capabilities of PVS-Studio and Visual Studio 2010 in detecting defe...Comparing capabilities of PVS-Studio and Visual Studio 2010 in detecting defe...
Comparing capabilities of PVS-Studio and Visual Studio 2010 in detecting defe...PVS-Studio
 
The forgotten problems of 64-bit programs development
The forgotten problems of 64-bit programs developmentThe forgotten problems of 64-bit programs development
The forgotten problems of 64-bit programs developmentPVS-Studio
 
Optimization of 64-bit programs
Optimization of 64-bit programsOptimization of 64-bit programs
Optimization of 64-bit programsPVS-Studio
 
The essence of the VivaCore code analysis library
The essence of the VivaCore code analysis libraryThe essence of the VivaCore code analysis library
The essence of the VivaCore code analysis libraryPVS-Studio
 
#PICHR posts from January 2015
#PICHR posts from January 2015#PICHR posts from January 2015
#PICHR posts from January 2015Kyle Jones
 
Kylemjones.com the hr-to_who_interview_michael_carty
Kylemjones.com the hr-to_who_interview_michael_cartyKylemjones.com the hr-to_who_interview_michael_carty
Kylemjones.com the hr-to_who_interview_michael_cartyKyle Jones
 
Mississippi SHRM Social Media Report July 2012
Mississippi SHRM Social Media Report July 2012Mississippi SHRM Social Media Report July 2012
Mississippi SHRM Social Media Report July 2012Kyle Jones
 
Social Media For business e-book
Social Media For business e-bookSocial Media For business e-book
Social Media For business e-bookThink Digital First
 
Avoiding Iatrogenic Consulting
Avoiding Iatrogenic ConsultingAvoiding Iatrogenic Consulting
Avoiding Iatrogenic ConsultingEd Kless
 
Livro aluno
Livro alunoLivro aluno
Livro alunoBlairvll
 

En vedette (20)

Analyzing the Blender project with PVS-Studio
Analyzing the Blender project with PVS-StudioAnalyzing the Blender project with PVS-Studio
Analyzing the Blender project with PVS-Studio
 
Wade not in unknown waters. Part two.
Wade not in unknown waters. Part two.Wade not in unknown waters. Part two.
Wade not in unknown waters. Part two.
 
PVS-Studio vs Clang
PVS-Studio vs ClangPVS-Studio vs Clang
PVS-Studio vs Clang
 
Reanalyzing the Notepad++ project
Reanalyzing the Notepad++ projectReanalyzing the Notepad++ project
Reanalyzing the Notepad++ project
 
I want to sell a PVS-Studio license to the Intel company
I want to sell a PVS-Studio license to the Intel companyI want to sell a PVS-Studio license to the Intel company
I want to sell a PVS-Studio license to the Intel company
 
Parallel Lint
Parallel LintParallel Lint
Parallel Lint
 
Introduction into 64 bits for the beginners or where's again the 64-bit world?
Introduction into 64 bits for the beginners or where's again the 64-bit world?Introduction into 64 bits for the beginners or where's again the 64-bit world?
Introduction into 64 bits for the beginners or where's again the 64-bit world?
 
How we test the code analyzer
How we test the code analyzerHow we test the code analyzer
How we test the code analyzer
 
Comparing capabilities of PVS-Studio and Visual Studio 2010 in detecting defe...
Comparing capabilities of PVS-Studio and Visual Studio 2010 in detecting defe...Comparing capabilities of PVS-Studio and Visual Studio 2010 in detecting defe...
Comparing capabilities of PVS-Studio and Visual Studio 2010 in detecting defe...
 
The forgotten problems of 64-bit programs development
The forgotten problems of 64-bit programs developmentThe forgotten problems of 64-bit programs development
The forgotten problems of 64-bit programs development
 
Optimization of 64-bit programs
Optimization of 64-bit programsOptimization of 64-bit programs
Optimization of 64-bit programs
 
The essence of the VivaCore code analysis library
The essence of the VivaCore code analysis libraryThe essence of the VivaCore code analysis library
The essence of the VivaCore code analysis library
 
#PICHR posts from January 2015
#PICHR posts from January 2015#PICHR posts from January 2015
#PICHR posts from January 2015
 
Arvores natal mobi
Arvores natal mobiArvores natal mobi
Arvores natal mobi
 
Abav 2011
Abav 2011Abav 2011
Abav 2011
 
Kylemjones.com the hr-to_who_interview_michael_carty
Kylemjones.com the hr-to_who_interview_michael_cartyKylemjones.com the hr-to_who_interview_michael_carty
Kylemjones.com the hr-to_who_interview_michael_carty
 
Mississippi SHRM Social Media Report July 2012
Mississippi SHRM Social Media Report July 2012Mississippi SHRM Social Media Report July 2012
Mississippi SHRM Social Media Report July 2012
 
Social Media For business e-book
Social Media For business e-bookSocial Media For business e-book
Social Media For business e-book
 
Avoiding Iatrogenic Consulting
Avoiding Iatrogenic ConsultingAvoiding Iatrogenic Consulting
Avoiding Iatrogenic Consulting
 
Livro aluno
Livro alunoLivro aluno
Livro aluno
 

Similaire à Analyzing the Quake III Arena GPL project

Rechecking TortoiseSVN with the PVS-Studio Code Analyzer
Rechecking TortoiseSVN with the PVS-Studio Code AnalyzerRechecking TortoiseSVN with the PVS-Studio Code Analyzer
Rechecking TortoiseSVN with the PVS-Studio Code AnalyzerAndrey Karpov
 
Checking the Source SDK Project
Checking the Source SDK ProjectChecking the Source SDK Project
Checking the Source SDK ProjectAndrey Karpov
 
Tesseract. Recognizing Errors in Recognition Software
Tesseract. Recognizing Errors in Recognition SoftwareTesseract. Recognizing Errors in Recognition Software
Tesseract. Recognizing Errors in Recognition SoftwareAndrey Karpov
 
100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects 100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects Andrey Karpov
 
Miranda NG Project to Get the "Wild Pointers" Award (Part 1)
Miranda NG Project to Get the "Wild Pointers" Award (Part 1) Miranda NG Project to Get the "Wild Pointers" Award (Part 1)
Miranda NG Project to Get the "Wild Pointers" Award (Part 1) Andrey Karpov
 
A Spin-off: CryEngine 3 SDK Checked with CppCat
A Spin-off: CryEngine 3 SDK Checked with CppCatA Spin-off: CryEngine 3 SDK Checked with CppCat
A Spin-off: CryEngine 3 SDK Checked with CppCatAndrey Karpov
 
Analyzing Firebird 3.0
Analyzing Firebird 3.0Analyzing Firebird 3.0
Analyzing Firebird 3.0PVS-Studio
 
A few words about OpenSSL
A few words about OpenSSLA few words about OpenSSL
A few words about OpenSSLPVS-Studio
 
PVS-Studio vs Chromium - Continuation
PVS-Studio vs Chromium - ContinuationPVS-Studio vs Chromium - Continuation
PVS-Studio vs Chromium - ContinuationPVS-Studio
 
Top 10 bugs in C++ open source projects, checked in 2016
Top 10 bugs in C++ open source projects, checked in 2016Top 10 bugs in C++ open source projects, checked in 2016
Top 10 bugs in C++ open source projects, checked in 2016PVS-Studio
 
PVS-Studio Meets Octave
PVS-Studio Meets Octave PVS-Studio Meets Octave
PVS-Studio Meets Octave PVS-Studio
 
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 1
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 1Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 1
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 1PVS-Studio
 
Picking Mushrooms after Cppcheck
Picking Mushrooms after CppcheckPicking Mushrooms after Cppcheck
Picking Mushrooms after CppcheckAndrey Karpov
 
Top 10 C# projects errors found in 2016
Top 10 C# projects errors found in 2016Top 10 C# projects errors found in 2016
Top 10 C# projects errors found in 2016PVS-Studio
 
LibRaw, Coverity SCAN, PVS-Studio
LibRaw, Coverity SCAN, PVS-StudioLibRaw, Coverity SCAN, PVS-Studio
LibRaw, Coverity SCAN, PVS-StudioAndrey Karpov
 
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...PVS-Studio
 
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...Andrey Karpov
 
The Little Unicorn That Could
The Little Unicorn That CouldThe Little Unicorn That Could
The Little Unicorn That CouldPVS-Studio
 
The Unicorn's Travel to the Microcosm
The Unicorn's Travel to the MicrocosmThe Unicorn's Travel to the Microcosm
The Unicorn's Travel to the MicrocosmAndrey Karpov
 
PVS-Studio for Linux Went on a Tour Around Disney
PVS-Studio for Linux Went on a Tour Around DisneyPVS-Studio for Linux Went on a Tour Around Disney
PVS-Studio for Linux Went on a Tour Around DisneyPVS-Studio
 

Similaire à Analyzing the Quake III Arena GPL project (20)

Rechecking TortoiseSVN with the PVS-Studio Code Analyzer
Rechecking TortoiseSVN with the PVS-Studio Code AnalyzerRechecking TortoiseSVN with the PVS-Studio Code Analyzer
Rechecking TortoiseSVN with the PVS-Studio Code Analyzer
 
Checking the Source SDK Project
Checking the Source SDK ProjectChecking the Source SDK Project
Checking the Source SDK Project
 
Tesseract. Recognizing Errors in Recognition Software
Tesseract. Recognizing Errors in Recognition SoftwareTesseract. Recognizing Errors in Recognition Software
Tesseract. Recognizing Errors in Recognition Software
 
100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects 100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects
 
Miranda NG Project to Get the "Wild Pointers" Award (Part 1)
Miranda NG Project to Get the "Wild Pointers" Award (Part 1) Miranda NG Project to Get the "Wild Pointers" Award (Part 1)
Miranda NG Project to Get the "Wild Pointers" Award (Part 1)
 
A Spin-off: CryEngine 3 SDK Checked with CppCat
A Spin-off: CryEngine 3 SDK Checked with CppCatA Spin-off: CryEngine 3 SDK Checked with CppCat
A Spin-off: CryEngine 3 SDK Checked with CppCat
 
Analyzing Firebird 3.0
Analyzing Firebird 3.0Analyzing Firebird 3.0
Analyzing Firebird 3.0
 
A few words about OpenSSL
A few words about OpenSSLA few words about OpenSSL
A few words about OpenSSL
 
PVS-Studio vs Chromium - Continuation
PVS-Studio vs Chromium - ContinuationPVS-Studio vs Chromium - Continuation
PVS-Studio vs Chromium - Continuation
 
Top 10 bugs in C++ open source projects, checked in 2016
Top 10 bugs in C++ open source projects, checked in 2016Top 10 bugs in C++ open source projects, checked in 2016
Top 10 bugs in C++ open source projects, checked in 2016
 
PVS-Studio Meets Octave
PVS-Studio Meets Octave PVS-Studio Meets Octave
PVS-Studio Meets Octave
 
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 1
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 1Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 1
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 1
 
Picking Mushrooms after Cppcheck
Picking Mushrooms after CppcheckPicking Mushrooms after Cppcheck
Picking Mushrooms after Cppcheck
 
Top 10 C# projects errors found in 2016
Top 10 C# projects errors found in 2016Top 10 C# projects errors found in 2016
Top 10 C# projects errors found in 2016
 
LibRaw, Coverity SCAN, PVS-Studio
LibRaw, Coverity SCAN, PVS-StudioLibRaw, Coverity SCAN, PVS-Studio
LibRaw, Coverity SCAN, PVS-Studio
 
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...
 
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...
 
The Little Unicorn That Could
The Little Unicorn That CouldThe Little Unicorn That Could
The Little Unicorn That Could
 
The Unicorn's Travel to the Microcosm
The Unicorn's Travel to the MicrocosmThe Unicorn's Travel to the Microcosm
The Unicorn's Travel to the Microcosm
 
PVS-Studio for Linux Went on a Tour Around Disney
PVS-Studio for Linux Went on a Tour Around DisneyPVS-Studio for Linux Went on a Tour Around Disney
PVS-Studio for Linux Went on a Tour Around Disney
 

Dernier

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Dernier (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

Analyzing the Quake III Arena GPL project

  • 1. Analyzing the Quake III Arena GPL project Author: Andrey Karpov Date: 06.02.2012 As you know, the id Software company has laid out source codes of many of their games. We already checked some of these projects earlier. This time we decided to analyze the Quake III Arena GPL source code. Analysis was performed with PVS-Studio 4.54. Unfortunately, the post about the check appeared to be bare and without detailed comments. We haven't found such errors in Quake III Arena GPL as to write an interesting article about. Moreover, some of the found errors we have already seen when checking the Doom 3 game's code. Below we will cite code fragments with various errors and corresponding diagnostic messages that helped us to find them. As usually, we want to note that these are far not all the errors the PVS-Studio analyzer can detect in this project: • If an error is found several times, only one case is described. • The article does not contain descriptions of unessential errors. • We do not cite code fragments about which we cannot decide quickly whether or not there is an error. Readers can study diagnostic messages generated by PVS-Studio themselves if they wish. The new trial mode allows you to do that easily. Fragment N1. Diagnostic message V511. The sizeof() operator returns size of the pointer, and not of the array, in 'sizeof(src)' expression. ID_INLINE mat3_t::mat3_t( float src[ 3 ][ 3 ] ) { memcpy( mat, src, sizeof( src ) ); } Correct code: memcpy( mat, src, sizeof(float) * 3 * 3); Fragment N2.
  • 2. Diagnostic message V501. There are identical sub-expressions '(result->flags & 64)' to the left and to the right of the '||' operator. void BotMoveToGoal(....) { ... if ((result->flags & MOVERESULT_ONTOPOF_FUNCBOB) || (result->flags & MOVERESULT_ONTOPOF_FUNCBOB)) { ms->reachability_time = AAS_Time() + 5; } ... } Fragment N3. Diagnostic message V510. The 'ScriptError' function is not expected to receive class-type variable as third actual argument. typedef struct punctuation_s { char *p; int n; struct punctuation_s *next; } punctuation_t; punctuation_t *punctuations; int PS_ExpectTokenType(script_t *script, ....) { ...
  • 3. ScriptError(script, "expected %s, found %s", script->punctuations[subtype], token->string); ... } Fragment N4. Diagnostic message V570. The 'p->org[0]' variable is assigned to itself. void CG_ParticleSnowFlurry (qhandle_t pshader, centity_t *cent) { ... p->org[0] = p->org[0]; p->org[1] = p->org[1]; p->org[2] = p->org[2]; ... } Fragment N5. Diagnostic message V568. It's odd that the argument of sizeof() operator is the '& itemInfo' expression. void CG_RegisterItemVisuals( int itemNum ) { itemInfo_t *itemInfo; ... memset( itemInfo, 0, sizeof( &itemInfo ) ); } Correct code:
  • 4. memset( itemInfo, 0, sizeof( *itemInfo ) ); Fragment N6. Diagnostic message V595. The 'item' pointer was utilized before it was verified against nullptr. Check lines: 3865, 3869. void Item_Paint(itemDef_t *item) { vec4_t red; menuDef_t *parent = (menuDef_t*)item->parent; red[0] = red[3] = 1; red[1] = red[2] = 0; if (item == NULL) { return; } ... } Fragment N7. Diagnostic message V557. Array overrun is possible. The 'sizeof (bs->teamleader)' index is pointing beyond array bound. typedef struct bot_activategoal_s { ... float leadbackup_time; char teamleader[32]; float askteamleader_time; ...
  • 5. } bot_state_t; void BotTeamAI(bot_state_t *bs) { ... bs->teamleader[sizeof(bs->teamleader)] = '0'; ... } Fragment N8. Diagnostic message V579. The Com_Memset function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the third argument. void Cvar_Restart_f( void ) { cvar_t *var; ... // clear the var completely, since we // can't remove the index from the list Com_Memset( var, 0, sizeof( var ) ); ... } Correct code: Com_Memset( var, 0, sizeof( *var ) ); Fragment N9. Diagnostic message V557. Array overrun is possible. The '3' index is pointing beyond array bound. void RB_CalcColorFromOneMinusEntity( unsigned char *dstColors )
  • 6. { int *pColors = ( int * ) dstColors; unsigned char invModulate[3]; int c; ... invModulate[0]=255-backEnd.currentEntity->e.shaderRGBA[0]; invModulate[1]=255-backEnd.currentEntity->e.shaderRGBA[1]; invModulate[2]=255-backEnd.currentEntity->e.shaderRGBA[2]; invModulate[3]=255-backEnd.currentEntity->e.shaderRGBA[3]; ... } Fragment N10. Diagnostic message V521. Such expressions using the ',' operator are dangerous. Make sure the expression is correct. void Q1_AllocMaxBSP(void) { ... q1_allocatedbspmem += Q1_MAX_MAP_CLIPNODES * sizeof(q1_dclipnode_t); ... q1_allocatedbspmem += Q1_MAX_MAP_EDGES , sizeof(q1_dedge_t); ... q1_allocatedbspmem += Q1_MAX_MAP_MARKSURFACES * sizeof(unsigned short); ... } Correct code:
  • 7. Q1_MAX_MAP_EDGES * sizeof(q1_dedge_t); Fragment N11. Diagnostic message V595. The 'node' pointer was utilized before it was verified against nullptr. Check lines: 769, 770. void FloodPortals_r (node_t *node, int dist) { ... if (node->occupied) Error("FloodPortals_r: node already occupiedn"); if (!node) { Error("FloodPortals_r: NULL noden"); } ... } Fragment N12. Diagnostic message V501. There are identical sub-expressions 'fabs(dir[1]) > test->radius' to the left and to the right of the '||' operator. int VL_FindAdjacentSurface(....) { ... if (fabs(dir[0]) > test->radius || fabs(dir[1]) > test->radius || fabs(dir[1]) > test->radius) {
  • 8. ... } Fragment N13. Diagnostic message V517. The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 3333, 3335. void CMainFrame::OnClipSelected() { ... if (g_bPatchBendMode) Patch_BendHandleENTER(); else if (g_bPatchBendMode) Patch_InsDelHandleENTER(); ... } Fragment N14. Diagnostic message V579. The memset function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the third argument. void CXYWnd::Paste() { ... char* pBuffer = new char[nLen+1]; memset( pBuffer, 0, sizeof(pBuffer) ); ... }
  • 9. Correct code: memset( pBuffer, 0, (nLen+1) * sizeof(char) ); Fragment N15. Diagnostic message V519. The 'numQuadCels' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1004, 1006. static void setupQuad( long xOff, long yOff ) { ... numQuadCels = (.....); numQuadCels += numQuadCels/4 + numQuadCels/16; numQuadCels += 64; numQuadCels = (.....); numQuadCels += numQuadCels/4; numQuadCels += 64; ... } Fragment N16. Diagnostic message V537. Consider reviewing the correctness of 'scale_x' item's usage. void Terrain_AddMovePoint(....) { ... x = ( v[ 0 ] - p->origin[ 0 ] ) / p->scale_x; y = ( v[ 1 ] - p->origin[ 1 ] ) / p->scale_x; ...
  • 10. } Correct code: y = ( v[ 1 ] - p->origin[ 1 ] ) / p->scale_y; Fragment N17. Diagnostic message V557. Array overrun is possible. The value of 'i' index could reach 3. int numteamVotingClients[2]; void CalculateRanks( void ) { ... for ( i = 0; i < TEAM_NUM_TEAMS; i++ ) { level.numteamVotingClients[i] = 0; } ... } Fragment N18. Diagnostic message V591. Non-void function should return a value. static ID_INLINE int BigLong(int l) { LongSwap(l); } Correct code: static ID_INLINE int BigLong(int l) { return LongSwap(l); }
  • 11. Conclusion It took me about three hours to find all these errors. This time includes downloading the source codes, the analysis itself, analyzing the results and copying out the most interesting code fragments. As you see, a static analyzer is a very efficient tool of error search. However, it is even more efficient when used regularly.