In May 2016, German game-development company Crytek made a decision to upload the source code of their game engine CryEngine V to Github. The engine is written in C++ and has immediately attracted attention of both the open-source developer community and the team of developers of PVS-Studio static analyzer who regularly scan the code of open-source projects to estimate its quality. A lot of great games were created by a number of video-game development studios using various versions of CryEngine, and now the engine has become available to even more developers. This article gives an overview of errors found in the project by PVS-Studio static analyzer.
The PVS-Studio developers' team has carried out comparison of the own static code analyzer PVS-Studio with the open-source Cppcheck static code analyzer. As a material for comparison, the source codes of the three open-source projects by id Software were chosen: Doom 3, Quake 3: Arena, Wolfenstein: Enemy Territory. The article describes the comparison methodology and lists of detected errors. The conclusions section at the end of the article contains "non-conclusions" actually, as we consciously avoid drawing any conclusions: you can reproduce our comparison and draw your own ones.
PVS-Studio is a static code analyzer that checks C, C++ and C# code for bugs. It supports projects developed with Windows (Visual Studio) and Linux (Clang, GCC). It integrates with tools like Visual Studio, SonarQube and supports standalone use. PVS-Studio detects many types of bugs like null pointer dereferences, uninitialized variables, dead code, buffer overflows, security issues and more. It has been effective at finding real bugs in major open source projects.
Every now and then, we have to write articles about how we've checked another fresh version of some compiler. That's not really much fun. However, as practice shows, if we stop doing that for a while, folks start doubting whether PVS-Studio is worth its title of a good catcher of bugs and vulnerabilities. What if the new compiler can do that too? Sure, compilers evolve, but so does PVS-Studio – and it proves, again and again, its ability to catch bugs even in high-quality projects such as compilers.
We have checked the Windows 8 Driver Samples pack with our analyzer PVS-Studio and found various bugs in its samples. There is nothing horrible about it - bugs can be found everywhere, so the title of this article may sound a bit high-flown. But these particular errors may be really dangerous, as it is a usual practice for developers to use demo samples as a basis for their own projects or borrow code fragments from them.
In May 2016, German game-development company Crytek made the, decision to upload the source code of their game engine, 'CryEngine V' to GitHub. The project is in active development, which leads to a large number of errors in the code. We have already checked the project with PVS-Studio for Windows, and now we can also analyze it using PVS-Studio for Linux. There was enough material for an article with the description of only crucial errors.
Virtual machines are important tools in the arsenal of a software developer. Being an active user of VirtualBox, and checking various open source projects with the help of it, I was personally interested in checking its source code. We did the first check of this project in 2014, and the description of 50 errors barely fit into two articles. With the release of Windows 10 and VirtualBox 5.0.XX the stability of the program got significantly worse, in my humble opinion. So, I decided to check the project again.
Dusting the globe: analysis of NASA World Wind projectPVS-Studio
Sometimes it is useful to look back to see how helpful the analyzer was to old projects, and which errors can be avoided in good time, if the analyzer is regularly used. This time our choice was NASA World Wind project, which was being developed on C# until 2007.
The PVS-Studio developers' team has carried out comparison of the own static code analyzer PVS-Studio with the open-source Cppcheck static code analyzer. As a material for comparison, the source codes of the three open-source projects by id Software were chosen: Doom 3, Quake 3: Arena, Wolfenstein: Enemy Territory. The article describes the comparison methodology and lists of detected errors. The conclusions section at the end of the article contains "non-conclusions" actually, as we consciously avoid drawing any conclusions: you can reproduce our comparison and draw your own ones.
PVS-Studio is a static code analyzer that checks C, C++ and C# code for bugs. It supports projects developed with Windows (Visual Studio) and Linux (Clang, GCC). It integrates with tools like Visual Studio, SonarQube and supports standalone use. PVS-Studio detects many types of bugs like null pointer dereferences, uninitialized variables, dead code, buffer overflows, security issues and more. It has been effective at finding real bugs in major open source projects.
Every now and then, we have to write articles about how we've checked another fresh version of some compiler. That's not really much fun. However, as practice shows, if we stop doing that for a while, folks start doubting whether PVS-Studio is worth its title of a good catcher of bugs and vulnerabilities. What if the new compiler can do that too? Sure, compilers evolve, but so does PVS-Studio – and it proves, again and again, its ability to catch bugs even in high-quality projects such as compilers.
We have checked the Windows 8 Driver Samples pack with our analyzer PVS-Studio and found various bugs in its samples. There is nothing horrible about it - bugs can be found everywhere, so the title of this article may sound a bit high-flown. But these particular errors may be really dangerous, as it is a usual practice for developers to use demo samples as a basis for their own projects or borrow code fragments from them.
In May 2016, German game-development company Crytek made the, decision to upload the source code of their game engine, 'CryEngine V' to GitHub. The project is in active development, which leads to a large number of errors in the code. We have already checked the project with PVS-Studio for Windows, and now we can also analyze it using PVS-Studio for Linux. There was enough material for an article with the description of only crucial errors.
Virtual machines are important tools in the arsenal of a software developer. Being an active user of VirtualBox, and checking various open source projects with the help of it, I was personally interested in checking its source code. We did the first check of this project in 2014, and the description of 50 errors barely fit into two articles. With the release of Windows 10 and VirtualBox 5.0.XX the stability of the program got significantly worse, in my humble opinion. So, I decided to check the project again.
Dusting the globe: analysis of NASA World Wind projectPVS-Studio
Sometimes it is useful to look back to see how helpful the analyzer was to old projects, and which errors can be avoided in good time, if the analyzer is regularly used. This time our choice was NASA World Wind project, which was being developed on C# until 2007.
Discussing Errors in Unity3D's Open-Source ComponentsPVS-Studio
Unity3D is one of the most promising and rapidly developing game engines to date. Every now and then, the developers upload new libraries and components to the official repository, many of which weren't available in as open-source projects until recently. Unfortunately, the Unity3D developer team allowed the public to dissect only some of the components, libraries, and demos employed by the project, while keeping the bulk of its code closed. In this article, we will try to find bugs and typos in those components with the help of PVS-Studio static analyzer.
A Spin-off: CryEngine 3 SDK Checked with CppCatAndrey Karpov
CppCat was used to analyze the CryEngine 3 SDK project. Several potential bugs were found, including redundant checks, missing function names, undefined behavior, careless entity names, and obsolete new operator usage. In total, over 30 issues were identified ranging from logical errors to style issues. Static analysis was recommended to find bugs early and reduce future issues.
We Continue Exploring Tizen: C# Components Proved to be of High QualityPVS-Studio
This time I go back again to the check of the Tizen project. In my recent post "Experiment of Bug Detection in the Code of C #Components of Tizen" in our blog, I analyzed the code of C# superficially and came to a conclusion that it makes sense to check the whole code of C# components of this project for errors using PVS-Studio and write the article about it. Right away, I would like to share with you the results of the work that I have done. I shall tell at once that PVS-Studio analyzer showed itself not on the bright side on C# code. Anyway, first things first: let's see what the analyzer found, and then we will deal with statistics and make conclusions.
Rechecking TortoiseSVN with the PVS-Studio Code AnalyzerAndrey Karpov
The author downloaded and analyzed the source code of the TortoiseSVN project using the PVS-Studio static code analyzer. The analysis found several bugs, including identical comparisons, unsafe uses of formatting functions like printf(), and obsolete null checks after memory allocation. While many of the issues would not cause failures, some could lead to undefined behavior, especially in 64-bit systems where pointer sizes are larger than integer types. The author concludes by recommending regular use of static analysis to find bugs early.
Linux version of PVS-Studio couldn't help checking CodeLitePVS-Studio
As is already known to our readers, PVS-Studio static analyzer is exploring a new development direction - the Linux platform; as you may have noticed from the previous articles, it is doing well. This article shows how easily you can check a project with the help of the Linux version of the analyzer, because the simpler PVS-Studio for Linux is, the more supporters it will have. This time our choice was the CodeLite project. CodeLite was compiled and tested in Linux. Let's see what results we got.
The document discusses unit testing and test-driven development. It introduces the QUnit JavaScript testing framework, describing how to write tests and assertions using its API. Key aspects covered include setting up QUnit, the test and assert functions, asynchronous testing, grouping tests into modules, and integrating automated testing with Node and Grunt.
A Long-Awaited Check of Unreal Engine 4Andrey Karpov
On March 19, 2014, Unreal Engine 4 was made public available. Subscription costs only $19 per month. The source codes have also been published at the github repository. Since that moment, we have received quite a number of e-mails, twitter messages, etc., people asking to check this game engine. So we are fulfilling our readers' request in this article; let's see what interesting bugs the PVS-Studio static code analyzer has found in the project's source code.
This is the correct article about the results of checking the Geant4 project, which I have written after the previous incorrect one. Let me remind you the whole story. I have recently checked an old version of the Geant4 library and reported the results in the article "Copy-Paste and Muons". Why old version? Nobody is perfect, and we finally made a mistake ourselves. To find out which exactly, see the previous article. This time I offer you a brief report about checking Geant4 of the version 10.0-beta.
Don't expect anything epic from this article. We have checked the Bitcoin project's source code with PVS-Studio and found just a couple of suspicious fragments. Which is no wonder: I guess there are few programmers who haven't checked it already. But since we have done our check too, we need to write a small post about it, pro forma, so to say.
Analyzing the Blender project with PVS-StudioPVS-Studio
We go on analyzing open source projects and making the software world better. This time we have checked the Blender 2.62 package intended for creating 3D computer graphics.
An important event has taken place in the PVS-Studio analyzer's life: support of C#-code analysis was added in the latest version. As one of its developers, I couldn't but try it on some project. Reading about scanning small and little-known projects is not much interesting of course, so it had to be something popular, and I picked MonoDevelop.
Stop Making Excuses and Start Testing Your JavaScriptRyan Anklam
The document provides tips for adding testing to JavaScript projects. It recommends choosing a testing environment and dialect, then setting up the tests by installing dependencies and configuring files. Common issues like testing asynchronous code and methods that call other methods can be addressed with spies, stubs, mocks and promises. Tests should focus on isolated units of code and avoid direct DOM manipulation when possible. Automating testing through build tools like Grunt and Testem helps to easily run and watch tests. Overall, the document emphasizes making testing easy by writing maintainable, modular code and setting up automation.
Tamir Dresher presents an introduction to Reactive Extensions (Rx) which provides a framework for building asynchronous and event-based applications. Rx allows composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. The presentation covers Rx core concepts like Observables and Observers, creating Observables, Rx queries, and managing concurrency using Schedulers.
Re-checking the ReactOS project - a large reportPVS-Studio
The ReactOS project is rapidly developing. One of the developers participating in this project suggested that we re-analyzed the source code, as the code base is growing fast. We were glad to do that. We like this project, and we'll be happy if this article helps the developers to eliminate some bugs. Analysis was performed with the PVS-Studio 5.02 code analyzer.
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...PVS-Studio
The article demonstrates errors detected with the static code analyzer integrated into Visual Studio 2010. The research was performed on five open source projects. The same projects were also checked with PVS-Studio. Results of comparing these two tools are presented at the end of the article.
Errors that static code analysis does not find because it is not usedAndrey Karpov
Readers of our articles occasionally note that the PVS-Studio static code analyzer detects a large number of errors that are insignificant and don't affect the application. It is really so. For the most part, important bugs have already been fixed due to manual testing, user feedback, and other expensive methods. At the same time, many of these errors could have been found at the code writing stage and corrected with minimal loss of time, reputation and money. This article will provide several examples of real errors, which could have been immediately fixed, if project authors had used static code analysis.
After hot discussions on the article about "The Big Calculator" I felt like checking some other projects related to scientific computations. The first program that came to hand was the open-source project OpenMS dealing with protein mass spectrometry. This project appeared to have been written in a very serious and responsible way. Developers use at least Cppcheck to analyze their project. That's why I didn't hope to find anything sensational left unnoticed by that tool. On the other hand, I was curious to see what bugs PVS-Studio would be able to find in the code after Cppcheck. If you want to know this too, follow me.
This document discusses dependency injection in CDI. It begins with a brief history of CDI and then covers the different ways that dependencies can be injected including via attributes, constructors, setters, qualifiers and programmatic lookup. It also discusses how to inject producers like entity managers and how CDI enables loose coupling and strong typing. The document concludes by emphasizing that CDI is capable of much more than just dependency injection.
Checking the Code of LDAP-Server ReOpenLDAP on Our Readers' RequestPVS-Studio
In this article, I'd like to talk about the analysis of ReOpenLDAP project. It was developed to help solve issues that PAO (PJSC) MegaFon, Russia's largest mobile network operator, was faced with when employing OpenLDAP in their infrastructure. ReOpenLDAP is now successfully used in MegaFon affiliates all over Russia, so we thought it would be interesting to check such a high-load project as this one with our static analyzer PVS-Studio.
Clang static analyzer found some errors in PVS-Studio source code when it was checked against Clang. The errors included using uninitialized variables, uninitialized pointers, and unsafe type conversions. While not critical bugs, they indicate areas for improvement. Clang also reported some false positives but helped uncover unused code that could be removed. Overall, using Clang provided a useful review of PVS-Studio and highlighted opportunities to strengthen the code quality.
The document summarizes two small studies conducted by students to examine the relationship between inadequate sleep and unintentional injuries. A qualitative study using an online focus group of 4 students explored perceptions of sleep and injuries. It found inadequate sleep negatively impacts health and can increase risks. A quantitative survey of 18 students further examined the relationship, finding agreement that inadequate sleep impacts judgment and awareness and may increase injury risks. Both studies had limitations as student exercises but provided insight into how policies could help address the issue.
Complementing Unit Testing with Static Analysis, with NUnit as an ExamplePVS-Studio
When discussing static analysis tools for C# projects, programmers will often deny the necessity of static analysis arguing that most errors can be caught through unit testing. So, I decided to find out how well one of the most popular unit-testing frameworks, NUnit, was tested and see if our analyzer could find anything of interest there.
Discussing Errors in Unity3D's Open-Source ComponentsPVS-Studio
Unity3D is one of the most promising and rapidly developing game engines to date. Every now and then, the developers upload new libraries and components to the official repository, many of which weren't available in as open-source projects until recently. Unfortunately, the Unity3D developer team allowed the public to dissect only some of the components, libraries, and demos employed by the project, while keeping the bulk of its code closed. In this article, we will try to find bugs and typos in those components with the help of PVS-Studio static analyzer.
A Spin-off: CryEngine 3 SDK Checked with CppCatAndrey Karpov
CppCat was used to analyze the CryEngine 3 SDK project. Several potential bugs were found, including redundant checks, missing function names, undefined behavior, careless entity names, and obsolete new operator usage. In total, over 30 issues were identified ranging from logical errors to style issues. Static analysis was recommended to find bugs early and reduce future issues.
We Continue Exploring Tizen: C# Components Proved to be of High QualityPVS-Studio
This time I go back again to the check of the Tizen project. In my recent post "Experiment of Bug Detection in the Code of C #Components of Tizen" in our blog, I analyzed the code of C# superficially and came to a conclusion that it makes sense to check the whole code of C# components of this project for errors using PVS-Studio and write the article about it. Right away, I would like to share with you the results of the work that I have done. I shall tell at once that PVS-Studio analyzer showed itself not on the bright side on C# code. Anyway, first things first: let's see what the analyzer found, and then we will deal with statistics and make conclusions.
Rechecking TortoiseSVN with the PVS-Studio Code AnalyzerAndrey Karpov
The author downloaded and analyzed the source code of the TortoiseSVN project using the PVS-Studio static code analyzer. The analysis found several bugs, including identical comparisons, unsafe uses of formatting functions like printf(), and obsolete null checks after memory allocation. While many of the issues would not cause failures, some could lead to undefined behavior, especially in 64-bit systems where pointer sizes are larger than integer types. The author concludes by recommending regular use of static analysis to find bugs early.
Linux version of PVS-Studio couldn't help checking CodeLitePVS-Studio
As is already known to our readers, PVS-Studio static analyzer is exploring a new development direction - the Linux platform; as you may have noticed from the previous articles, it is doing well. This article shows how easily you can check a project with the help of the Linux version of the analyzer, because the simpler PVS-Studio for Linux is, the more supporters it will have. This time our choice was the CodeLite project. CodeLite was compiled and tested in Linux. Let's see what results we got.
The document discusses unit testing and test-driven development. It introduces the QUnit JavaScript testing framework, describing how to write tests and assertions using its API. Key aspects covered include setting up QUnit, the test and assert functions, asynchronous testing, grouping tests into modules, and integrating automated testing with Node and Grunt.
A Long-Awaited Check of Unreal Engine 4Andrey Karpov
On March 19, 2014, Unreal Engine 4 was made public available. Subscription costs only $19 per month. The source codes have also been published at the github repository. Since that moment, we have received quite a number of e-mails, twitter messages, etc., people asking to check this game engine. So we are fulfilling our readers' request in this article; let's see what interesting bugs the PVS-Studio static code analyzer has found in the project's source code.
This is the correct article about the results of checking the Geant4 project, which I have written after the previous incorrect one. Let me remind you the whole story. I have recently checked an old version of the Geant4 library and reported the results in the article "Copy-Paste and Muons". Why old version? Nobody is perfect, and we finally made a mistake ourselves. To find out which exactly, see the previous article. This time I offer you a brief report about checking Geant4 of the version 10.0-beta.
Don't expect anything epic from this article. We have checked the Bitcoin project's source code with PVS-Studio and found just a couple of suspicious fragments. Which is no wonder: I guess there are few programmers who haven't checked it already. But since we have done our check too, we need to write a small post about it, pro forma, so to say.
Analyzing the Blender project with PVS-StudioPVS-Studio
We go on analyzing open source projects and making the software world better. This time we have checked the Blender 2.62 package intended for creating 3D computer graphics.
An important event has taken place in the PVS-Studio analyzer's life: support of C#-code analysis was added in the latest version. As one of its developers, I couldn't but try it on some project. Reading about scanning small and little-known projects is not much interesting of course, so it had to be something popular, and I picked MonoDevelop.
Stop Making Excuses and Start Testing Your JavaScriptRyan Anklam
The document provides tips for adding testing to JavaScript projects. It recommends choosing a testing environment and dialect, then setting up the tests by installing dependencies and configuring files. Common issues like testing asynchronous code and methods that call other methods can be addressed with spies, stubs, mocks and promises. Tests should focus on isolated units of code and avoid direct DOM manipulation when possible. Automating testing through build tools like Grunt and Testem helps to easily run and watch tests. Overall, the document emphasizes making testing easy by writing maintainable, modular code and setting up automation.
Tamir Dresher presents an introduction to Reactive Extensions (Rx) which provides a framework for building asynchronous and event-based applications. Rx allows composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. The presentation covers Rx core concepts like Observables and Observers, creating Observables, Rx queries, and managing concurrency using Schedulers.
Re-checking the ReactOS project - a large reportPVS-Studio
The ReactOS project is rapidly developing. One of the developers participating in this project suggested that we re-analyzed the source code, as the code base is growing fast. We were glad to do that. We like this project, and we'll be happy if this article helps the developers to eliminate some bugs. Analysis was performed with the PVS-Studio 5.02 code analyzer.
Comparing the general static analysis in Visual Studio 2010 and PVS-Studio by...PVS-Studio
The article demonstrates errors detected with the static code analyzer integrated into Visual Studio 2010. The research was performed on five open source projects. The same projects were also checked with PVS-Studio. Results of comparing these two tools are presented at the end of the article.
Errors that static code analysis does not find because it is not usedAndrey Karpov
Readers of our articles occasionally note that the PVS-Studio static code analyzer detects a large number of errors that are insignificant and don't affect the application. It is really so. For the most part, important bugs have already been fixed due to manual testing, user feedback, and other expensive methods. At the same time, many of these errors could have been found at the code writing stage and corrected with minimal loss of time, reputation and money. This article will provide several examples of real errors, which could have been immediately fixed, if project authors had used static code analysis.
After hot discussions on the article about "The Big Calculator" I felt like checking some other projects related to scientific computations. The first program that came to hand was the open-source project OpenMS dealing with protein mass spectrometry. This project appeared to have been written in a very serious and responsible way. Developers use at least Cppcheck to analyze their project. That's why I didn't hope to find anything sensational left unnoticed by that tool. On the other hand, I was curious to see what bugs PVS-Studio would be able to find in the code after Cppcheck. If you want to know this too, follow me.
This document discusses dependency injection in CDI. It begins with a brief history of CDI and then covers the different ways that dependencies can be injected including via attributes, constructors, setters, qualifiers and programmatic lookup. It also discusses how to inject producers like entity managers and how CDI enables loose coupling and strong typing. The document concludes by emphasizing that CDI is capable of much more than just dependency injection.
Checking the Code of LDAP-Server ReOpenLDAP on Our Readers' RequestPVS-Studio
In this article, I'd like to talk about the analysis of ReOpenLDAP project. It was developed to help solve issues that PAO (PJSC) MegaFon, Russia's largest mobile network operator, was faced with when employing OpenLDAP in their infrastructure. ReOpenLDAP is now successfully used in MegaFon affiliates all over Russia, so we thought it would be interesting to check such a high-load project as this one with our static analyzer PVS-Studio.
Clang static analyzer found some errors in PVS-Studio source code when it was checked against Clang. The errors included using uninitialized variables, uninitialized pointers, and unsafe type conversions. While not critical bugs, they indicate areas for improvement. Clang also reported some false positives but helped uncover unused code that could be removed. Overall, using Clang provided a useful review of PVS-Studio and highlighted opportunities to strengthen the code quality.
The document summarizes two small studies conducted by students to examine the relationship between inadequate sleep and unintentional injuries. A qualitative study using an online focus group of 4 students explored perceptions of sleep and injuries. It found inadequate sleep negatively impacts health and can increase risks. A quantitative survey of 18 students further examined the relationship, finding agreement that inadequate sleep impacts judgment and awareness and may increase injury risks. Both studies had limitations as student exercises but provided insight into how policies could help address the issue.
Complementing Unit Testing with Static Analysis, with NUnit as an ExamplePVS-Studio
When discussing static analysis tools for C# projects, programmers will often deny the necessity of static analysis arguing that most errors can be caught through unit testing. So, I decided to find out how well one of the most popular unit-testing frameworks, NUnit, was tested and see if our analyzer could find anything of interest there.
Chatbots, and how will Microsoft help us with this?PVS-Studio
This overview article is devoted to the study of a trend which is growing rapidly in popularity in the IT industry - chatbots, and the role of Microsoft in their development process. The article will cover the history of chatbots, peculiar properties of bots, the main, and also some unexpected spheres of their application, perspectives and technology limits.
We have deliberately chosen Microsoft as the main platform for comparative research. The company does a lot of work in the field of promotion and development of intelligent bots. One of the main steps in this direction is a framework for creation of custom bots Microsoft Bot Framework platform - independent and open source; Microsoft presented it at the Build 2016 exhibition.
This report discusses the relationship between inadequate sleep and unintentional injury. It reviews background information and relevant literature on the topic. The methods section outlines the study design. The results show rates of unintentional injury in different regions over time. Key findings and conclusions from the study are discussed.
The document discusses implementing a SMS reference service for the Millennial generation using Google Voice. Millennials are heavy users of texting, with half sending 50+ texts per day. An SMS reference service would allow library patrons to ask questions via text message. Setting up the service through Google Voice is easy and free - you claim a phone number, verify it, and can begin texting. The service could be used for circulation notices, feedback, and promoting programs.
Segundo volumen del análisis de la Pobreza en Honduras, con una perspectiva de soluciones integrales y propuestas para una nueva forma de enfrentar el fenómeno.
This report discusses the relationship between inadequate sleep and unintentional injury. It reviews background information and literature on the topic and describes the methods, results, and findings of a study comparing injury rates across geographic regions in different quarters. The discussion section reflects on the implications of the results.
Fosdeh Visión 2016, Ambiente de Inversión en HondurasFOSDEH
El documento presenta información sobre la situación económica y social de Honduras. Detalla los niveles de deuda externa del país desde 2004 a 2015 y los principales obstáculos para la inversión como la corrupción y el crimen. También analiza temas como el crecimiento del PIB, el sector bancario, las remesas familiares y los sectores con mayor crecimiento económico en Honduras.
El Foro Social de la Deuda Externa y Desarrollo de Honduras, presenta su publicación mas reciente del suplemento "Realidad Nacional", donde se abordan acontecimientos económicos y sociales de Honduras.
Cyber bullying awareness professional development meetinganniebee3509
This document discusses cyberbullying and provides information about what it is, statistics around its prevalence, and resources to address it. Cyberbullying involves tormenting, threatening, harassing or humiliating someone online using technology like social media. It affects many teens, though few talk to parents about incidents. The document outlines different types of cyberbullying and compares it to traditional bullying. It also provides lesson plans and resources for teachers, parents and students to help prevent and address cyberbullying.
The document discusses the need and implementation of an SMS reference service for a library to connect with millennial students. Millennials are heavy users of texting, with half sending 50 or more texts per day. The service would use Google Voice, which allows libraries to get a phone number and forward texts to provide reference assistance via SMS. It proposes this could help with circulation notices, feedback, and promoting programs.
The document discusses spool requests in SAP systems. It defines what a spool request contains, where it is stored, and the different spool statuses and their meanings. It also describes which work processes create spool requests and output requests, and the difference between the two. The document then provides answers to common questions about spool overflow issues, how to troubleshoot them, check spool numbers, delete old requests, and define the storage location for spool requests.
Heading for a Record: Chromium, the 5th CheckPVS-Studio
We checked Chromium more than once before, and those who follow our blog could reasonably ask, "Why another check? Weren't there enough of them?" Sure, Chromium's source code is particularly clean, which was shown by each of the previous checks, but new errors inevitably continue to appear. Repeated checks prove that the more often you use static analysis, the better. A good practice is to use the analyzer every day. An even better practice is to analyze the new code right after you finish writing it (automatic analysis of recently modified code).
I read a post recently about a check of the LibRaw project performed by Coverity SCAN. It stated that nothing interesting had been found. So I decided to try our analyzer PVS-Studio on it.
Analysis of PascalABC.NET using SonarQube plugins: SonarC# and PVS-StudioPVS-Studio
In November 2016, we posted an article about the development and use of the PVS-Studio plugin for SonarQube. We received great feedback from our customers and interested users who requested testing the plugin on a real project. As the interest in this subject is not decreasing, we decided to test the plugin on a C# project PascalABC.NET. Also, it should be borne in mind, that SonarQube have their own static analyzer of C# code - SonarC#. To make the report more complete, we decided to test SonarC# as well. The objective of this work was not the comparison of the analyzers, but the demonstration of the main peculiarities of their interaction with the SonarQube service. Plain comparison of the analyzers would not be fair due to the fact that PVS-Studio is a specialized tool for bug detection and potential vulnerabilities, while SonarQube is a service for the assessment of the code quality by a large number of parameters: code duplication, compliance with the code standards, unit tests coverage, potential bugs in the code, density of comments in the code, technical debt and so on.
One of the Microsoft development teams already uses PVS-Studio analyzer in their work. It's great, but it's not enough. That's why I keep demonstrating how static code analysis could benefit developers, using Microsoft projects as examples. We scanned Casablanca project three years ago and found nothing. As a tribute to its high quality, the project was awarded with a "bugless code" medal. As time went by, Casablanca developed and grew. PVS-Studio's capabilities, too, have significantly improved, and now I've finally got the opportunity to write an article about errors found by the analyzer in Casablanca project (C++ REST SDK). These errors are few, but the fact that their number is still big enough for me to make this article, does speak a lot in favor of PVS-Studio's effectiveness.
Porting is a Delicate Matter: Checking Far Manager under LinuxPVS-Studio
Far Manager, which takes over from Norton Commander, created back in the times of DOS, is one of the most popular file managers on Microsoft Windows. Far Manager facilitates the file system management (file creation, editing, viewing, copying, moving, search, and deletion) and provides means to extend the standard feature set (handling of the network, archives, backup copies, and so on). Far Manager was recently ported to Linux, and there is currently an alpha version available. The PVS-Studio team couldn't ignore that event and miss the opportunity to test the quality of the ported code.
Some of you may know that we have recently released version 6.00 of our analyzer, that now has C# support. The ability to scan C# projects increases the number of open-source projects we can analyze. This article is about one such check. This time it is a project, developed by Sony Computer Entertainment (SCEI).
Media Portal 2 is open software of a media center class, allowing the user to listen to music, watch videos, viewing pictures, and much more. For us, the developers of PVS-Studio static analyzer, this is another chance to check an interesting project, tell people (and developers) about the errors we find, and demonstrate the abilities of our analyzer of course.
The document analyzes the source code of the Godot game engine using the PVS-Studio static code analyzer. It finds and discusses several types of errors identified by the analyzer, including duplicated comparisons, array overruns due to enum/array mismatches, incorrect data type checks, typos causing logic errors or infinite loops, and unsafe pointer usage. The analysis aims to both introduce readers to the Godot project and help its developers fix bugs and improve code quality.
Accord.Net: Looking for a Bug that Could Help Machines Conquer HumankindPVS-Studio
Articles discussing the results of analysis of open-source projects are a good thing as they benefit everyone: some, including project authors themselves, can find out what bugs lurk in a project; others discover for themselves the static analysis technology and start using it to improve their code's quality. For us, it is a wonderful means to promote PVS-Studio analyzer, as well as to put it through some additional testing. This time I have analyzed Accord.Net framework and found lots of interesting issues in its code.
To measure the efficiency of our analyzer, and also to promote the methodology of static analysis, we regularly analyze open source projects for bugs and write articles about the results. 2016 was no exception. This year is especially important as it is the year of the "growth" of the C# analyzer. PVS-Studio has obtained a large number of new C# diagnostics, an improved virtual values mechanism (symbolic execution) and much more. Based on the results of our teamwork, I compiled a kind of chart of the most interesting bugs, found in various C# projects in 2016.
Explanations to the article on Copy-PastePVS-Studio
Many readers liked my article "Consequences of using the Copy-Paste method in C++ programming and how to deal with it" [1]. Scott Meyers [2] noticed it too and asked me how static analysis proper helped us to detect the errors described in the article.
Bugs found in GCC with the help of PVS-StudioPVS-Studio
I regularly check various open-source projects to demonstrate the abilities of the PVS-Studio static code analyzer (C, C++, C#). Now it is time for the GCC compiler to get checked. Unquestionably, GCC is a very qualitative and well-tested project, that's why it's already a great achievement for a tool to find any errors in it. Fortunately, PVS-Studio coped with this task. No one is immune to typos or carelessness. This is why the PVS-Studio can become an additional line of defense for you, on the front of the endless war against bugs.
Top 10 bugs in C++ open source projects, checked in 2016PVS-Studio
While the world is discussing the 89th Ceremony of Oscar award and charts of actors and costumes, we've decided to write a review article about the IT-sphere. The article is going to cover the most interesting bugs, made in open source projects in 2016. This year was remarkable for our tool, as PVS-Studio has become available on Linux OS. The errors we present are hopefully, already fixed, but every reader can see how serious are the errors made by developers.
The PVS-Studio team is now actively developing a static analyzer for C# code. The first version is expected by the end of 2015. And for now my task is to write a few articles to attract C# programmers' attention to our tool in advance. I've got an updated installer today, so we can now install PVS-Studio with C#-support enabled and even analyze some source code. Without further hesitation, I decided to scan whichever program I had at hand. This happened to be the Umbraco project. Of course we can't expect too much of the current version of the analyzer, but its functionality has been enough to allow me to write this small article.
PVS-Studio for Linux Went on a Tour Around DisneyPVS-Studio
Recently we released a Linux version of PVS-Studio analyzer, which we had used before to check a number of open-source projects such as Chromium, GCC, LLVM (Clang), and others. Now this list includes several projects developed by Walt Disney Animation Studios for the community of virtual-reality developers. Let's see what bugs and defects the analyzer found in these projects.
Errors detected in the Visual C++ 2012 librariesPVS-Studio
Static code analysis is one of the error detection methodologies. We are glad that this methodology is becoming more and more popular nowadays. Visual Studio which includes static analysis as one of its many features contributes to this process to a large extent. This feature is easy to try and start using regularly. When one understands one likes static code analysis, we are glad to offer a professional analyzer PVS-Studio for the languages C/C++/C++11.
In this article, we will speak about the static analysis of the doxygen documentation generator tool. This popular and widely used project, which, as its authors claim, not without reason, has become "the de facto standard tool for generating documentation from annotated C++ sources", has never been scanned by PVS-Studio before. Doxygen scans the program source code and generates the documentation relying on it. Now it's time for us to peep into its source files and see if PVS-Studio can find any interesting bugs there.
In this article, I'm going to tell you about my experience of analyzing the Octave project. It is quite a popular one, especially among students who need to scan their math task solutions yet don't feel like buying a Matlab license.
Date Processing Attracts Bugs or 77 Defects in Qt 6Andrey Karpov
The recent Qt 6 release compelled us to recheck the framework with PVS-Studio. In this article, we reviewed various interesting errors we found, for example, those related to processing dates. The errors we discovered prove that developers can greatly benefit from regularly checking their projects with tools like PVS-Studio.
64-Bit Code in 2015: New in the Diagnostics of Possible IssuesPVS-Studio
64-bit issues are pretty hard to detect because they are like a timebomb: it may take quite a while before they show up. The PVS-Studio static analyzer makes it easier to find and fix such errors. But we have made even a few more steps forward: we have recently revised with more care the 64-bit diagnostics implemented in our tool, which resulted in changing their distribution among severity levels. In this article, I'm going to tell you about these changes and how it affected the tool handling and bug search. You will also find real-life examples of 64-bit errors.
Nashik's top web development company, Upturn India Technologies, crafts innovative digital solutions for your success. Partner with us and achieve your goals
Implementing Odoo, a robust and all-inclusive business management software, can significantly improve your organisation. To get the most out of it and ensure a smooth implementation, it is important to have a strategic plan. This blog shares some essential tips to help you with successful Odoo ERP implementation. From planning and customisation to training and support, this blog outlines some expert advice that will guide you through the process confidently. It is true that adopting a new software can be challenging, and hence, this post has tailored these tips to help you avoid common mistakes and achieve the best results. Whether you run a small business or a large enterprise, these tips will help you streamline operations, boost productivity, and drive growth. Whether you are new to Odoo or looking to improve your current setup, it is essential to learn the key strategies for a successful Odoo implementation. Implementing Odoo doesn’t have to be difficult. With the right approach and guidance, you can use this software to elevate your business. Read on to discover the secrets of a successful Odoo implementation.
Why is successful Odoo implementation crucial?
Implementing Odoo effectively can transform your business by making processes smoother, increasing efficiency, and providing useful insights. It helps align your operations with best practices, boosting productivity and aiding better decision-making. A well-executed implementation ensures you get the most out of your investment, while a poor one can cause disruptions, higher costs, and frustration among employees.
Photoshop Tutorial for Beginners (2024 Edition)alowpalsadig
Photoshop Tutorial for Beginners (2024 Edition)
Explore the evolution of programming and software development and design in 2024. Discover emerging trends shaping the future of coding in our insightful analysis."
Here's an overview:Introduction: The Evolution of Programming and Software DevelopmentThe Rise of Artificial Intelligence and Machine Learning in CodingAdopting Low-Code and No-Code PlatformsQuantum Computing: Entering the Software Development MainstreamIntegration of DevOps with Machine Learning: MLOpsAdvancements in Cybersecurity PracticesThe Growth of Edge ComputingEmerging Programming Languages and FrameworksSoftware Development Ethics and AI RegulationSustainability in Software EngineeringThe Future Workforce: Remote and Distributed TeamsConclusion: Adapting to the Changing Software Development LandscapeIntroduction: The Evolution of Programming and Software Development
Photoshop Tutorial for Beginners (2024 Edition)Explore the evolution of programming and software development and design in 2024. Discover emerging trends shaping the future of coding in our insightful analysis."Here's an overview:Introduction: The Evolution of Programming and Software DevelopmentThe Rise of Artificial Intelligence and Machine Learning in CodingAdopting Low-Code and No-Code PlatformsQuantum Computing: Entering the Software Development MainstreamIntegration of DevOps with Machine Learning: MLOpsAdvancements in Cybersecurity PracticesThe Growth of Edge ComputingEmerging Programming Languages and FrameworksSoftware Development Ethics and AI RegulationSustainability in Software EngineeringThe Future Workforce: Remote and Distributed TeamsConclusion: Adapting to the Changing Software Development LandscapeIntroduction: The Evolution of Programming and Software Development
The importance of developing and designing programming in 2024
Programming design and development represents a vital step in keeping pace with technological advancements and meeting ever-changing market needs. This course is intended for anyone who wants to understand the fundamental importance of software development and design, whether you are a beginner or a professional seeking to update your knowledge.
Course objectives:
1. **Learn about the basics of software development:
- Understanding software development processes and tools.
- Identify the role of programmers and designers in software projects.
2. Understanding the software design process:
- Learn about the principles of good software design.
- Discussing common design patterns such as Object-Oriented Design.
3. The importance of user experience (UX) in modern software:
- Explore how user experience can improve software acceptance and usability.
- Tools and techniques to analyze and improve user experience.
4. Increase efficiency and productivity through modern development tools:
- Access to the latest programming tools and languages used in the industry.
- Study live examples of applications
Building API data products on top of your real-time data infrastructureconfluent
This talk and live demonstration will examine how Confluent and Gravitee.io integrate to unlock value from streaming data through API products.
You will learn how data owners and API providers can document, secure data products on top of Confluent brokers, including schema validation, topic routing and message filtering.
You will also see how data and API consumers can discover and subscribe to products in a developer portal, as well as how they can integrate with Confluent topics through protocols like REST, Websockets, Server-sent Events and Webhooks.
Whether you want to monetize your real-time data, enable new integrations with partners, or provide self-service access to topics through various protocols, this webinar is for you!
Enhanced Screen Flows UI/UX using SLDS with Tom KittPeter Caitens
Join us for an engaging session led by Flow Champion, Tom Kitt. This session will dive into a technique of enhancing the user interfaces and user experiences within Screen Flows using the Salesforce Lightning Design System (SLDS). This technique uses Native functionality, with No Apex Code, No Custom Components and No Managed Packages required.
Streamlining End-to-End Testing Automation with Azure DevOps Build & Release Pipelines
Automating end-to-end (e2e) test for Android and iOS native apps, and web apps, within Azure build and release pipelines, poses several challenges. This session dives into the key challenges and the repeatable solutions implemented across multiple teams at a leading Indian telecom disruptor, renowned for its affordable 4G/5G services, digital platforms, and broadband connectivity.
Challenge #1. Ensuring Test Environment Consistency: Establishing a standardized test execution environment across hundreds of Azure DevOps agents is crucial for achieving dependable testing results. This uniformity must seamlessly span from Build pipelines to various stages of the Release pipeline.
Challenge #2. Coordinated Test Execution Across Environments: Executing distinct subsets of tests using the same automation framework across diverse environments, such as the build pipeline and specific stages of the Release Pipeline, demands flexible and cohesive approaches.
Challenge #3. Testing on Linux-based Azure DevOps Agents: Conducting tests, particularly for web and native apps, on Azure DevOps Linux agents lacking browser or device connectivity presents specific challenges in attaining thorough testing coverage.
This session delves into how these challenges were addressed through:
1. Automate the setup of essential dependencies to ensure a consistent testing environment.
2. Create standardized templates for executing API tests, API workflow tests, and end-to-end tests in the Build pipeline, streamlining the testing process.
3. Implement task groups in Release pipeline stages to facilitate the execution of tests, ensuring consistency and efficiency across deployment phases.
4. Deploy browsers within Docker containers for web application testing, enhancing portability and scalability of testing environments.
5. Leverage diverse device farms dedicated to Android, iOS, and browser testing to cover a wide range of platforms and devices.
6. Integrate AI technology, such as Applitools Visual AI and Ultrafast Grid, to automate test execution and validation, improving accuracy and efficiency.
7. Utilize AI/ML-powered central test automation reporting server through platforms like reportportal.io, providing consolidated and real-time insights into test performance and issues.
These solutions not only facilitate comprehensive testing across platforms but also promote the principles of shift-left testing, enabling early feedback, implementing quality gates, and ensuring repeatability. By adopting these techniques, teams can effectively automate and execute tests, accelerating software delivery while upholding high-quality standards across Android, iOS, and web applications.
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio, Inc.
Alluxio Webinar
June. 18, 2024
For more Alluxio Events: https://www.alluxio.io/events/
Speaker:
- Jianjian Xie (Staff Software Engineer, Alluxio)
As Trino users increasingly rely on cloud object storage for retrieving data, speed and cloud cost have become major challenges. The separation of compute and storage creates latency challenges when querying datasets; scanning data between storage and compute tiers becomes I/O bound. On the other hand, cloud API costs related to GET/LIST operations and cross-region data transfer add up quickly.
The newly introduced Trino file system cache by Alluxio aims to overcome the above challenges. In this session, Jianjian will dive into Trino data caching strategies, the latest test results, and discuss the multi-level caching architecture. This architecture makes Trino 10x faster for data lakes of any scale, from GB to EB.
What you will learn:
- Challenges relating to the speed and costs of running Trino in the cloud
- The new Trino file system cache feature overview, including the latest development status and test results
- A multi-level cache framework for maximized speed, including Trino file system cache and Alluxio distributed cache
- Real-world cases, including a large online payment firm and a top ridesharing company
- The future roadmap of Trino file system cache and Trino-Alluxio integration
Software Test Automation - A Comprehensive Guide on Automated Testing.pdfkalichargn70th171
Moving to a more digitally focused era, the importance of software is rapidly increasing. Software tools are crucial for upgrading life standards, enhancing business prospects, and making a smart world. The smooth and fail-proof functioning of the software is very critical, as a large number of people are dependent on them.
In this infographic, we have explored cost-effective strategies for iOS app development, focusing on building high-quality apps within a budget. Key points covered include prioritizing essential features, leveraging existing tools and libraries, adopting cross-platform development approaches, optimizing for a Minimum Viable Product (MVP), and integrating with cloud services and third-party APIs. By implementing these strategies, businesses and developers can create functional and engaging iOS apps while minimizing development costs and time-to-market.
Stork Product Overview: An AI-Powered Autonomous Delivery FleetVince Scalabrino
Imagine a world where instead of blue and brown trucks dropping parcels on our porches, a buzzing drove of drones delivered our goods. Now imagine those drones are controlled by 3 purpose-built AI designed to ensure all packages were delivered as quickly and as economically as possible That's what Stork is all about.
The Ultimate Guide to Top 36 DevOps Testing Tools for 2024.pdfkalichargn70th171
Testing is pivotal in the DevOps framework, serving as a linchpin for early bug detection and the seamless transition from code creation to deployment.
DevOps teams frequently adopt a Continuous Integration/Continuous Deployment (CI/CD) methodology to automate processes. A robust testing strategy empowers them to confidently deploy new code, backed by assurance that it has passed rigorous unit and performance tests.
Hyperledger Besu 빨리 따라하기 (Private Networks)wonyong hwang
Hyperledger Besu의 Private Networks에서 진행하는 실습입니다. 주요 내용은 공식 문서인https://besu.hyperledger.org/private-networks/tutorials 의 내용에서 발췌하였으며, Privacy Enabled Network와 Permissioned Network까지 다루고 있습니다.
This is a training session at Hyperledger Besu's Private Networks, with the main content excerpts from the official document besu.hyperledger.org/private-networks/tutorials and even covers the Private Enabled and Permitted Networks.
What is Continuous Testing in DevOps - A Definitive Guide.pdfkalichargn70th171
Once an overlooked aspect, continuous testing has become indispensable for enterprises striving to accelerate application delivery and reduce business impacts. According to a Statista report, 31.3% of global enterprises have embraced continuous integration and deployment within their DevOps, signaling a pervasive trend toward hastening release cycles.
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...kalichargn70th171
In today's fiercely competitive mobile app market, the role of the QA team is pivotal for continuous improvement and sustained success. Effective testing strategies are essential to navigate the challenges confidently and precisely. Ensuring the perfection of mobile apps before they reach end-users requires thoughtful decisions in the testing plan.
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISTier1 app
Are you ready to unlock the secrets hidden within Java thread dumps? Join us for a hands-on session where we'll delve into effective troubleshooting patterns to swiftly identify the root causes of production problems. Discover the right tools, techniques, and best practices while exploring *real-world case studies of major outages* in Fortune 500 enterprises. Engage in interactive lab exercises where you'll have the opportunity to troubleshoot thread dumps and uncover performance issues firsthand. Join us and become a master of Java thread dump analysis!
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
Long-Awaited Check of CryEngine V
1. Long-Awaited Check of CryEngine V
Author: Svyatoslav Razmyslov
Date: 03.08.2016
In May 2016, German game-development company Crytek made a decision to upload the source code of
their game engine CryEngine V to Github. The engine is written in C++ and has immediately attracted
attention of both the open-source developer community and the team of developers of PVS-Studio
static analyzer who regularly scan the code of open-source projects to estimate its quality. A lot of great
games were created by a number of video-game development studios using various versions of
CryEngine, and now the engine has become available to even more developers. This article gives an
overview of errors found in the project by PVS-Studio static analyzer.
Introduction
CryEngine is a game engine developed by German company Crytek in 2002 and originally used in first-
person shooter Far Cry. A lot of great games were created by a number of video-game development
studios using various licensed versions of CryEngine: Far Cry, Crysis, Entropia Universe, Blue Mars,
Warface, Homefront: The Revolution, Sniper: Ghost Warrior, Armored Warfare, Evolve, and many others.
In March 2016, Crytek announced a release date for their new engine CryEngine V and uploaded its
source code to Github soon after.
The project's source code was checked by PVS-Studio static analyzer, version 6.05. This is a tool
designed for detecting software errors in program source code in C, C++, and C#. The only true way of
using static analysis is to regularly scan code on developers' computers and build-servers. However, in
order to demonstrate PVS-Studio's diagnostic capabilities, we run single-time checks of open-source
projects and then write articles about errors found. If we like a project, we might scan it again a couple
of years later. Such recurring checks are in fact the same as single-time checks since the code
accumulates a lot of changes during that time.
For our checks, we pick projects that are simply popular and wide-known as well as projects suggested
by our readers via e-mail. That's why CryEngine V was by no means the first game engine among those
scanned by our analyzer. Other engines that we have already checked include:
Unreal Engine 4 (first check, second check, third check)
Check of Godot Engine
Check of Serious Engine
2. Check of X-Ray Engine
Check of Xenko Engine.
We also checked CryEngine 3 SDK once.
I'd like to elaborate on the check of Unreal Engine 4 engine in particular. Using that project as an
example allowed us to demonstrate in every detail what the right way of using static analysis on a real
project should look like, covering the whole process from the phase of integrating the analyzer into the
project to the phase of cutting warnings to zero with subsequent control over bug elimination in new
code. Our work on Unreal Engine 4 project developed into collaboration with Epic Games company, in
terms of which our team fixed all the defects found in the engine's source code and wrote a joint article
with Epic Games on the accomplished work (it was posted on Unreal Engine Blog). Epic Games also
purchased a PVS-Studio license to be able to maintain the quality of their code on their own.
Collaboration of this kind is something that we would like to try with Crytek, too.
Analyzer-report structure
In this article, I'd like to answer a few frequently asked questions concerning the number of warnings
and false positives, for example, "What is the ratio of false positives?" or "Why are there so few bugs in
so large a project?"
To begin with, all PVS-Studio warnings are classified into three severity levels: High, Medium, and Low.
The High level holds the most critical warnings, which are almost surely real errors, while the Low level
contains the least critical warnings or warnings that are very likely to be false positives. Keep in mind
that the codes of errors do not tie them firmly to particular severity levels: distribution of warnings
across the levels very much depends on the context.
This is how the warnings of the General Analysis module are distributed across the severity levels for
CryEngine V project:
High: 576 warnings;
Medium: 814 warnings,
Low: 2942 warnings.
Figure 1 shows distribution of the warnings across the levels in the form of a pie chart.
3. Figure 1 - Percentage distribution of warnings across severity levels
It is impossible to include all the warning descriptions and associated code fragments in an article. Our
articles typically discuss 10-40 commented cases; some warnings are given as a list; and most have to be
left unexamined. In the best-case scenario, project authors, after we inform them, ask for a complete
analysis report for close study. The bitter truth is that in most cases the number of High-level warnings
alone is more than enough for an article, and CryEngine V is no exception. Figure 2 shows the structure
of the High-level warnings issued for this project.
Figure 2 - Structure of High-level warnings
Let's take a closer look at the sectors of this chart:
Described in the article (6%) - warnings cited in the article and accompanied by code fragments
and commentary.
Presented as a list (46%) - warnings cited as a list. These warnings refer to the same pattern as
some of the errors already discussed, so only the warning text is given.
False Positives (8%) - a certain ratio of false positives we have taken into account for future
improvement of the analyzer.
Other (40%) - all the other warnings issued. These include warnings that we had to leave out so
that the article wouldn't grow too large, non-critical warnings, or warnings whose validity could
be estimated only by a member of the developer team. As our experience of working on Unreal
Engine 4 has shown, such code still "smells" and those warnings get fixed anyway.
4. Analysis results
Annoying copy-paste
V501 There are identical sub-expressions to the left and to the right of the '-' operator: q2.v.z - q2.v.z
entitynode.cpp 93
bool
CompareRotation(const Quat& q1, const Quat& q2, float epsilon)
{
return (fabs_tpl(q1.v.x - q2.v.x) <= epsilon)
&& (fabs_tpl(q1.v.y - q2.v.y) <= epsilon)
&& (fabs_tpl(q2.v.z - q2.v.z) <= epsilon) // <=
&& (fabs_tpl(q1.w - q2.w) <= epsilon);
}
A mistyped digit is probably one of the most annoying typos one can make. In the function above, the
analyzer detected a suspicious expression, (q2.v.z - q2.v.z), where variables q1 and q2 seem to have
been mixed up.
V501 There are identical sub-expressions '(m_eTFSrc == eTF_BC6UH)' to the left and to the right of the
'||' operator. texturestreaming.cpp 919
//! Texture formats.
enum ETEX_Format : uint8
{
....
eTF_BC4U, //!< 3Dc+.
eTF_BC4S,
eTF_BC5U, //!< 3Dc.
eTF_BC5S,
eTF_BC6UH,
eTF_BC6SH,
eTF_BC7,
eTF_R9G9B9E5,
....
};
bool CTexture::StreamPrepare(CImageFile* pIM)
{
....
5. if ((m_eTFSrc == eTF_R9G9B9E5) ||
(m_eTFSrc == eTF_BC6UH) || // <=
(m_eTFSrc == eTF_BC6UH)) // <=
{
m_cMinColor /= m_cMaxColor.a;
m_cMaxColor /= m_cMaxColor.a;
}
....
}
Another kind of typos deals with copying of constants. In this case, the m_eTFSrc variable is compared
twice with the eTF_BC6UH constant. The second of these checks must compare the variable with some
other constant whose name differs from the copied one in just one character, for example, eTF_BC6SH.
Two more similar issues:
V501 There are identical sub-expressions '(td.m_eTF == eTF_BC6UH)' to the left and to the right
of the '||' operator. texture.cpp 1214
V501 There are identical sub-expressions 'geom_colltype_solid' to the left and to the right of the
'|' operator. attachmentmanager.cpp 1004
V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error
presence. Check lines: 266, 268. d3dhwshader.cpp 266
int SD3DShader::Release(EHWShaderClass eSHClass, int nSize)
{
....
if (eSHClass == eHWSC_Pixel)
return ((ID3D11PixelShader*)pHandle)->Release();
else if (eSHClass == eHWSC_Vertex)
return ((ID3D11VertexShader*)pHandle)->Release();
else if (eSHClass == eHWSC_Geometry) // <=
return ((ID3D11GeometryShader*)pHandle)->Release(); // <=
else if (eSHClass == eHWSC_Geometry) // <=
return ((ID3D11GeometryShader*)pHandle)->Release(); // <=
else if (eSHClass == eHWSC_Hull)
return ((ID3D11HullShader*)pHandle)->Release();
else if (eSHClass == eHWSC_Compute)
return ((ID3D11ComputeShader*)pHandle)->Release();
else if (eSHClass == eHWSC_Domain)
return ((ID3D11DomainShader*)pHandle)->Release()
....
}
This is an example of lazy copying of a cascade of conditional statements, one of which was left
unchanged.
V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error
presence. Check lines: 970, 974. environmentalweapon.cpp 970
void CEnvironmentalWeapon::UpdateDebugOutput() const
{
....
const char* attackStateName = "None";
if(m_currentAttackState & // <=
EAttackStateType_EnactingPrimaryAttack) // <=
{
attackStateName = "Primary Attack";
6. }
else if(m_currentAttackState & // <=
EAttackStateType_EnactingPrimaryAttack) // <=
{
attackStateName = "Charged Throw";
}
....
}
In the previous example, there was at least a small chance that an extra condition resulted from making
too many copies of a code fragment, while the programmer simply forgot to remove one of the checks.
In this code, however, the attackStateName variable will never take the value "Charged Throw" because
of identical conditional expressions.
V519 The 'BlendFactor[2]' variable is assigned values twice successively. Perhaps this is a mistake. Check
lines: 1265, 1266. ccrydxgldevicecontext.cpp 1266
void CCryDXGLDeviceContext::
OMGetBlendState(...., FLOAT BlendFactor[4], ....)
{
CCryDXGLBlendState::ToInterface(ppBlendState, m_spBlendState);
if ((*ppBlendState) != NULL)
(*ppBlendState)->AddRef();
BlendFactor[0] = m_auBlendFactor[0];
BlendFactor[1] = m_auBlendFactor[1];
BlendFactor[2] = m_auBlendFactor[2]; // <=
BlendFactor[2] = m_auBlendFactor[3]; // <=
*pSampleMask = m_uSampleMask;
}
In this function, a typo in the element index prevents the element with index '3', BlendFactor[3], from
being filled with a value. This fragment would have remained just one of the many interesting examples
of typos, had not the analyzer found two more copies of the same incorrect fragment:
V519 The 'm_auBlendFactor[2]' variable is assigned values twice successively. Perhaps this is a mistake.
Check lines: 904, 905. ccrydxgldevicecontext.cpp 905
void CCryDXGLDeviceContext::
OMSetBlendState(....const FLOAT BlendFactor[4], ....)
{
....
m_uSampleMask = SampleMask;
if (BlendFactor == NULL)
{
m_auBlendFactor[0] = 1.0f;
m_auBlendFactor[1] = 1.0f;
m_auBlendFactor[2] = 1.0f; // <=
m_auBlendFactor[2] = 1.0f; // <=
}
else
{
m_auBlendFactor[0] = BlendFactor[0];
m_auBlendFactor[1] = BlendFactor[1];
m_auBlendFactor[2] = BlendFactor[2]; // <=
m_auBlendFactor[2] = BlendFactor[3]; // <=
}
m_pContext->SetBlendColor(m_auBlendFactor[0],
7. m_auBlendFactor[1],
m_auBlendFactor[2],
m_auBlendFactor[3]);
m_pContext->SetSampleMask(m_uSampleMask);
....
}
Here's that fragment where the element with index '3' is skipped again. I even thought for a moment
that there was some intentional pattern to it, but this thought quickly vanished as I saw that the
programmer attempted to access all the four elements of the m_auBlendFactor array at the end of the
function. It looks like the same code with a typo was simply copied several times in the file
ccrydxgldevicecontext.cpp.
V523 The 'then' statement is equivalent to the 'else' statement. d3dshadows.cpp 1410
void CD3D9Renderer::ConfigShadowTexgen(....)
{
....
if ((pFr->m_Flags & DLF_DIRECTIONAL) ||
(!(pFr->bUseHWShadowMap) && !(pFr->bHWPCFCompare)))
{
//linearized shadows are used for any kind of directional
//lights and for non-hw point lights
m_cEF.m_TempVecs[2][Num] = 1.f / (pFr->fFarDist);
}
else
{
//hw point lights sources have non-linear depth for now
m_cEF.m_TempVecs[2][Num] = 1.f / (pFr->fFarDist);
}
....
}
To finish the section on copy-paste, here is one more interesting error. No matter what result the
conditional expression produces, the value m_cEF.m_TempVecs[2][Num] is always computed by the
same formula. Judging by the surrounding code, the index is correct: it's exactly the element with index
'2' that must be filled with a value. It's just that the formula itself was meant to be different in each case,
and the programmer forgot to change the copied code.
Troubles with initialization
V546 Member of a class is initialized by itself: 'eConfigMax(eConfigMax)'. particleparams.h 1013
ParticleParams() :
....
fSphericalApproximation(1.f),
fVolumeThickness(1.0f),
fSoundFXParam(1.f),
eConfigMax(eConfigMax.VeryHigh), // <=
fFadeAtViewCosAngle(0.f)
{}
The analyzer detected a potential typo that causes a class field to be initialized to its own value.
8. V603 The object was created but it is not being used. If you wish to call constructor, 'this-
>SRenderingPassInfo::SRenderingPassInfo(....)' should be used. i3dengine.h 2589
SRenderingPassInfo()
: pShadowGenMask(NULL)
, nShadowSide(0)
, nShadowLod(0)
, nShadowFrustumId(0)
, m_bAuxWindow(0)
, m_nRenderStackLevel(0)
, m_eShadowMapRendering(static_cast<uint8>(SHADOW_MAP_NONE))
, m_bCameraUnderWater(0)
, m_nRenderingFlags(0)
, m_fZoomFactor(0.0f)
, m_pCamera(NULL)
, m_nZoomInProgress(0)
, m_nZoomMode(0)
, m_pJobState(nullptr)
{
threadID nThreadID = 0;
gEnv->pRenderer->EF_Query(EFQ_MainThreadList, nThreadID);
m_nThreadID = static_cast<uint8>(nThreadID);
m_nRenderFrameID = gEnv->pRenderer->GetFrameID();
m_nRenderMainFrameID = gEnv->pRenderer->GetFrameID(false);
}
SRenderingPassInfo(threadID id)
{
SRenderingPassInfo(); // <=
SetThreadID(id);
}
In this code, incorrect use of constructor was detected. The programmer probably assumed that calling
a constructor in a way like that - without parameters - inside another constructor would initialize the
class fields, but this assumption was wrong.
Instead, a new unnamed object of type SRenderingPassInfo will be created and immediately destroyed.
The class fields, therefore, will remain uninitialized. One way to fix this error is to create a separate
initialization function and call it from different constructors.
V688 The 'm_cNewGeomMML' local variable possesses the same name as one of the class members,
which can result in a confusion. terrain_node.cpp 344
void CTerrainNode::Init(....)
{
....
m_nOriginX = m_nOriginY = 0; // sector origin
m_nLastTimeUsed = 0; // basically last time rendered
uint8 m_cNewGeomMML = m_cCurrGeomMML = m_cNewGeomMML_Min ....
m_pLeafData = 0;
m_nTreeLevel = 0;
....
}
9. The name of the local variable cNewGeomMML coincides with that of a class field. It's usually not an
error, but in this particular case it does look strange in comparison to how the other class fields are
initialized.
V575 The 'memset' function processes '0' elements. Inspect the third argument. crythreadutil_win32.h
294
void EnableFloatExceptions(....)
{
....
CONTEXT ctx;
memset(&ctx, sizeof(ctx), 0); // <=
....
}
This error is a very interesting one. When calling the memset() function, two arguments were swapped
by mistake, which resulted in calling the function to fill 0 bytes. This is the function prototype:
void * memset ( void * ptr, int value, size_t num );
The function expects to receive the buffer size as the third argument and the value the buffer is to be
filled with as the second.
The fixed version:
void EnableFloatExceptions(....)
{
....
CONTEXT ctx;
memset(&ctx, 0, sizeof(ctx));
....
}
V630 The '_alloca' function is used to allocate memory for an array of objects which are classes
containing constructors. command_buffer.cpp 62
void CBuffer::Execute()
{
....
QuatT * pJointsTemp = static_cast<QuatT*>(
alloca(m_state.m_jointCount * sizeof(QuatT)));
....
}
In some parts of the project's code, the alloca() function is used to allocate memory for an array of
objects. In the example above, with memory allocated in such a way, neither the constructor, nor the
destructor will be called for objects of class QuatT. This defect may result in handling uninitialized
variables, and other errors.
Here's a complete list of other defects of this type:
V630 The '_alloca' function is used to allocate memory for an array of objects which are classes
containing constructors. command_buffer.cpp 67
V630 The '_alloca' function is used to allocate memory for an array of objects which are classes
containing constructors. posematching.cpp 144
V630 The '_alloca' function is used to allocate memory for an array of objects which are classes
containing constructors. characterinstance.cpp 280
10. V630 The '_alloca' function is used to allocate memory for an array of objects which are classes
containing constructors. characterinstance.cpp 282
V630 The '_alloca' function is used to allocate memory for an array of objects which are classes
containing constructors. scriptbind_entity.cpp 6252
V630 The '_alloca' function is used to allocate memory for an array of objects which are classes
containing constructors. jobmanager.cpp 1016
V630 The '_alloca' function is used to allocate memory for an array of objects which are classes
containing constructors. driverd3d.cpp 5859
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: -
1.8f. posealignerc3.cpp 330
ILINE bool InitializePoseAlignerPinger(....)
{
....
chainDesc.offsetMin = Vec3(0.0f, 0.0f, bIsMP ? -1.8f : -1.8f);
chainDesc.offsetMax = Vec3(0.0f, 0.0f, bIsMP ? +0.75f : +1.f);
....
}
A few fragments were found where the ternary operator ?: returns one and the same value. While in
the previous example it could have been done for aesthetic reasons, the reason for doing so in the
following fragment is unclear.
float predictDelta = inputSpeed < 0.0f ? 0.1f : 0.1f; // <=
float dict = angle + predictDelta * ( angle - m_prevAngle) / dt ;
A complete list of other defects of this type:
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same
value: -1.8f. posealignerc3.cpp 313
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same
value: -2.f. posealignerc3.cpp 347
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same
value: D3D11_RTV_DIMENSION_TEXTURE2DARRAY. d3dtexture.cpp 2277
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same
value: 255U. renderer.cpp 3389
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same
value: D3D12_RESOURCE_STATE_GENERIC_READ. dx12device.cpp 151
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same
value: 0.1f. vehiclemovementstdboat.cpp 720
V570 The 'runtimeData.entityId' variable is assigned to itself. behaviortreenodes_ai.cpp 1771
void ExecuteEnterScript(RuntimeData& runtimeData)
{
ExecuteScript(m_enterScriptFunction, runtimeData.entityId);
runtimeData.entityId = runtimeData.entityId; // <=
runtimeData.executeExitScriptIfDestructed = true;
}
A variable is assigned to itself, which doesn't look right. The authors should check this code.
11. Operation precedence
V502 Perhaps the '?:' operator works in a different way than it was expected. The '?:' operator has a
lower priority than the '+' operator. gpuparticlefeaturespawn.cpp 79
bool HasDuration() { return m_useDuration; }
void CFeatureSpawnRate::SpawnParticles(....)
{
....
SSpawnData& spawn = pRuntime->GetSpawnData(i);
const float amount = spawn.amount;
const int spawnedBefore = int(spawn.spawned);
const float endTime = spawn.delay +
HasDuration() ? spawn.duration : fHUGE;
....
}
The function above seems to measure time in a wrong way. The precedence of the addition operator is
higher than that of the ternary operator :?, so the value 0 or 1 is added to spawn.delay first, and then
the value spawn.duration or fHUGE is written into the endTime variable. This error is quite a common
one. To learn more about interesting patterns of errors involving operation precedence collected from
the PVS-Studio bug database, see my article: Logical Expressions in C/C++. Mistakes Made by
Professionals.
V634 The priority of the '*' operation is higher than that of the '<<' operation. It's possible that
parentheses should be used in the expression. model.cpp 336
enum joint_flags
{
angle0_locked = 1,
....
};
bool CDefaultSkeleton::SetupPhysicalProxies(....)
{
....
for (int j = 0; .... ; j++)
{
// lock axes with 0 limits range
m_arrModelJoints[i]....flags |= (....) * angle0_locked << j;
}
....
12. }
This is another very interesting error that has to do with the precedence of the multiplication and
bitwise shift operations. The latter has lower precedence, so the whole expression is multiplied by one
at each iteration (as the angle0_locked constant has the value one), which looks very strange.
This is what the programmer must have wanted that code to look like:
m_arrModelJoints[i]....flags |= (....) * (angle0_locked << j);
The following file contains a list of 35 suspicious fragments involving precedence of shift operations:
CryEngine5_V634.txt.
Undefined behavior
Undefined behavior is the result of executing computer code written in a certain programming language
that depends on a number of random factors such as memory state or triggered interrupts. In other
words, this result is not prescribed by the language specification. It is considered to be an error to let
such a situation occur in your program. Even if it can successfully execute on some compiler, it is not
guaranteed to be cross-platform and may fail on another machine, operating system, and even other
settings of the same compiler.
V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative.
physicalplaceholder.h 25
#ifndef physicalplaceholder_h
#define physicalplaceholder_h
#pragma once
....
const int NO_GRID_REG = -1<<14;
const int GRID_REG_PENDING = NO_GRID_REG+1;
....
Under the modern C++ standard, a left shift of a negative value is undefined behavior. The analyzer
found a few more similar issues in CryEngine V's code:
V610 Undefined behavior. Check the shift operator '<<'. The left operand
'~(TFragSeqStorage(0))' is negative. udpdatagramsocket.cpp 757
13. V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative.
tetrlattice.cpp 324
V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative.
tetrlattice.cpp 350
V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative.
tetrlattice.cpp 617
V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative.
tetrlattice.cpp 622
V610 Undefined behavior. Check the shift operator '<<'. The left operand '(~(0xF))' is negative.
d3ddeferredrender.cpp 876
V610 Undefined behavior. Check the shift operator '<<'. The left operand '(~(0xF))' is negative.
d3ddeferredshading.cpp 791
V610 Undefined behavior. Check the shift operator '<<'. The left operand '(~(1 << 0))' is
negative. d3dsprites.cpp 1038
V567 Undefined behavior. The 'm_current' variable is modified while being used twice between
sequence points. operatorqueue.cpp 105
bool COperatorQueue::Prepare(....)
{
++m_current &= 1;
m_ops[m_current].clear();
return true;
}
The analyzer detected an expression that causes undefined behavior. A variable is used multiple times
between two sequence points, while its value changes. The result of executing such an expression,
therefore, can't be determined.
Other similar issues:
V567 Undefined behavior. The 'itail' variable is modified while being used twice between
sequence points. trimesh.cpp 3101
V567 Undefined behavior. The 'ihead' variable is modified while being used twice between
sequence points. trimesh.cpp 3108
V567 Undefined behavior. The 'ivtx' variable is modified while being used twice between
sequence points. boolean3d.cpp 1194
V567 Undefined behavior. The 'ivtx' variable is modified while being used twice between
sequence points. boolean3d.cpp 1202
V567 Undefined behavior. The 'ivtx' variable is modified while being used twice between
sequence points. boolean3d.cpp 1220
V567 Undefined behavior. The 'm_commandBufferIndex' variable is modified while being used
twice between sequence points. xconsole.cpp 180
V567 Undefined behavior. The 'm_FrameFenceCursor' variable is modified while being used
twice between sequence points. ccrydx12devicecontext.cpp 952
V567 Undefined behavior. The 'm_iNextAnimIndex' variable is modified while being used twice
between sequence points. hitdeathreactionsdefs.cpp 192
14. Errors in conditions
V579 The memcmp function receives the pointer and its size as arguments. It is possibly a mistake.
Inspect the third argument. graphicspipelinestateset.h 58
bool
operator==(const SComputePipelineStateDescription& other) const
{
return 0 == memcmp(this, &other, sizeof(this)); // <=
}
The programmer made a mistake in the equality operation in the call to the memcmp() function, which
leads to passing the pointer size instead of the object size as a function argument. As a result, only the
first several bytes of the objects are compared.
The fixed version:
memcmp(this, &other, sizeof(*this));
Unfortunately, three more similar issues were found in the project:
V579 The memcpy function receives the pointer and its size as arguments. It is possibly a
mistake. Inspect the third argument. geomcacherendernode.cpp 286
V579 The AddObject function receives the pointer and its size as arguments. It is possibly a
mistake. Inspect the second argument. clipvolumemanager.cpp 145
V579 The memcmp function receives the pointer and its size as arguments. It is possibly a
mistake. Inspect the third argument. graphicspipelinestateset.h 34
V640 The code's operational logic does not correspond with its formatting. The second statement will
always be executed. It is possible that curly brackets are missing. livingentity.cpp 181
CLivingEntity::~CLivingEntity()
{
for(int i=0;i<m_nParts;i++) {
if (!m_parts[i].pPhysGeom || ....)
delete[] m_parts[i].pMatMapping; m_parts[i].pMatMapping=0;
}
....
}
15. I spotted a huge number of code blocks with statements written in one line. These include not only
ordinary assignments, but rather loops, conditions, function calls, and sometimes a mixture of all of
these (see Figure 3).
Figure 3 - Poor code formatting
In code of size like that, this programming style almost inevitably leads to errors. In the example above,
the memory block occupied by an array of objects was to be freed and the pointer was to be cleared
when a certain condition was met. However, incorrect code formatting causes the
m_parts[i].pMatMapping pointer to be cleared at every loop iteration. The implications of this problem
can't be predicted, but the code does look strange.
Other fragments with strange formatting:
V640 The code's operational logic does not correspond with its formatting. The second
statement will always be executed. It is possible that curly brackets are missing.
physicalworld.cpp 2449
V640 The code's operational logic does not correspond with its formatting. The second
statement will always be executed. It is possible that curly brackets are missing.
articulatedentity.cpp 1723
V640 The code's operational logic does not correspond with its formatting. The second
statement will always be executed. It is possible that curly brackets are missing.
articulatedentity.cpp 1726
V695 Range intersections are possible within conditional expressions. Example: if (A < 5) { ... } else if (A <
2) { ... }. Check lines: 538, 540. statobjrend.cpp 540
bool CStatObj::RenderDebugInfo(....)
{
....
ColorB clr(0, 0, 0, 0);
if (nRenderMats == 1)
clr = ColorB(0, 0, 255, 255);
else if (nRenderMats == 2)
clr = ColorB(0, 255, 255, 255);
else if (nRenderMats == 3)
clr = ColorB(0, 255, 0, 255);
else if (nRenderMats == 4)
clr = ColorB(255, 0, 255, 255);
else if (nRenderMats == 5)
clr = ColorB(255, 255, 0, 255);
else if (nRenderMats >= 6) // <=
clr = ColorB(255, 0, 0, 255);
else if (nRenderMats >= 11) // <=
clr = ColorB(255, 255, 255, 255);
....
}
The programmer made a mistake that prevents the color ColorB(255, 255, 255, 255) from ever being
selected. The values nRenderMats are first compared one by one with the numbers from 1 to 5, but
16. when comparing them with value ranges, the programmer didn't take into account that values larger
than 11 already belong to the range of values larger than 6, so the last condition will never execute.
This cascade of conditions was copied in full into one more fragment:
V695 Range intersections are possible within conditional expressions. Example: if (A < 5) { ... }
else if (A < 2) { ... }. Check lines: 338, 340. modelmesh_debugpc.cpp 340
V695 Range intersections are possible within conditional expressions. Example: if (A < 5) { ... } else if (A <
2) { ... }. Check lines: 393, 399. xmlcpb_nodelivewriter.cpp 399
enum eNodeConstants
{
....
CHILDBLOCKS_MAX_DIST_FOR_8BITS = BIT(7) - 1, // 127
CHILDBLOCKS_MAX_DIST_FOR_16BITS = BIT(6) - 1, // 63
....
};
void CNodeLiveWriter::Compact()
{
....
if (dist <= CHILDBLOCKS_MAX_DIST_FOR_8BITS) // dist <= 127
{
uint8 byteDist = dist;
writeBuffer.AddData(&byteDist, sizeof(byteDist));
isChildBlockSaved = true;
}
else if (dist <= CHILDBLOCKS_MAX_DIST_FOR_16BITS) // dist <= 63
{
uint8 byteHigh = CHILDBLOCKS_USING_MORE_THAN_8BITS | ....);
uint8 byteLow = dist & 255;
writeBuffer.AddData(&byteHigh, sizeof(byteHigh));
writeBuffer.AddData(&byteLow, sizeof(byteLow));
isChildBlockSaved = true;
}
....
}
A similar mistake inside a condition was also found in the fragment above, except that this time the
code that fails to get control is larger. The values of the constants CHILDBLOCKS_MAX_DIST_FOR_8BITS
and CHILDBLOCKS_MAX_DIST_FOR_16BITS are such that the second condition will never be true.
V547 Expression 'pszScript[iSrcBufPos] != '=='' is always true. The value range of char type: [-128, 127].
luadbg.cpp 716
bool CLUADbg::LoadFile(const char* pszFile, bool bForceReload)
{
FILE* hFile = NULL;
char* pszScript = NULL, * pszFormattedScript = NULL;
....
while (pszScript[iSrcBufPos] != ' ' &&
....
pszScript[iSrcBufPos] != '=' &&
pszScript[iSrcBufPos] != '==' && // <=
pszScript[iSrcBufPos] != '*' &&
pszScript[iSrcBufPos] != '+' &&
pszScript[iSrcBufPos] != '/' &&
17. pszScript[iSrcBufPos] != '~' &&
pszScript[iSrcBufPos] != '"')
{}
....
}
A large conditional expression contains a subexpression that is always true. The '==' literal will have type
int and correspond to the value 15677. The pszScript array consists of elements of type char, and a value
of type char can't be equal to 15677, so the pszScript[iSrcBufPos] != '==' expression is always true.
V734 An excessive expression. Examine the substrings "_ddn" and "_ddna". texture.cpp 4212
void CTexture::PrepareLowResSystemCopy(byte* pTexData, ....)
{
....
// make sure we skip non diffuse textures
if (strstr(GetName(), "_ddn") // <=
|| strstr(GetName(), "_ddna") // <=
|| strstr(GetName(), "_mask")
|| strstr(GetName(), "_spec.")
|| strstr(GetName(), "_gloss")
|| strstr(GetName(), "_displ")
|| strstr(GetName(), "characters")
|| strstr(GetName(), "$")
)
return;
....
}
The strstr() function looks for the first occurrence of the specified substring within another string and
returns either a pointer to the first occurrence or an empty pointer. The string "_ddn" is the first to be
searched, and "_ddna" is the second, which means that the condition will be true if the shorter string is
found. This code might not work as expected; or perhaps this expression is redundant and could be
simplified by removing the extra check.
V590 Consider inspecting this expression. The expression is excessive or contains a misprint.
goalop_crysis2.cpp 3779
void COPCrysis2FlightFireWeapons::ParseParam(....)
{
....
else if (!paused &&
(m_State == eFP_PAUSED) && // <=
(m_State != eFP_PAUSED_OVERRIDE)) // <=
....
}
The conditional expression in the ParseParam() function is written in such a way that its result does not
depend on the (m_State != eFP_PAUSED_OVERRIDE) subexpression.
Here's a simpler example:
if ( err == code1 && err != code2)
{
....
}
18. The result of the whole conditional expression does not depend on the result of the (err != code2)
subexpression, which can be clearly seen from the truth table for this example (see Figure 4)
Figure 4 - Truth table for a logical expression
Comparing unsigned values with zero
When scanning projects, we often come across comparisons of unsigned values with zero, which
produce either true or false every time. Such code does not always contain a critical bug; it is often a
result of too much caution or changing a variable's type from signed to unsigned. Anyway, such
comparisons need to be checked.
V547 Expression 'm_socket < 0' is always false. Unsigned type value is never < 0. servicenetwork.cpp 585
typedef SOCKET CRYSOCKET;
// Internal socket data
CRYSOCKET m_socket;
bool CServiceNetworkConnection::TryReconnect()
{
....
// Create new socket if needed
if (m_socket == 0)
{
m_socket = CrySock::socketinet();
19. if (m_socket < 0)
{
....
return false;
}
}
....
}
I'd like to elaborate on the SOCKET type. It can be both signed and unsigned depending on the
platforms, so it is strongly recommended that you use special macros and constants specified in the
standard headers when working with this type.
In cross-platform projects, comparisons with 0 or -1 are common that result in misinterpretation of
error codes. CryEngine V project is no exception, although some checks are done correctly, for example:
if (m_socket == CRY_INVALID_SOCKET)
Nevertheless, many parts of the code use different versions of these checks.
See the file CryEngine5_V547.txt for other 47 suspicious comparisons of unsigned variables with zero.
The code authors need to check these warnings.
Dangerous pointers
Diagnostic V595 detects pointers that are tested for null after they have been dereferenced. In practice,
this diagnostic catches very tough bugs. On rare occasions, it issues false positives, which is explained by
the fact that pointers are checked indirectly, i.e. through one or several other variables, but figuring
such code out isn't an easy task for a human either, is it? Three code samples are given below that
trigger this diagnostic and look especially surprising, as it's not clear why they work at all. For the other
warnings of this type see the file CryEngine5_V595.txt.
20. Example 1
V595 The 'm_pPartManager' pointer was utilized before it was verified against nullptr. Check lines:
1441, 1442. 3denginerender.cpp 1441
void C3DEngine::RenderInternal(....)
{
....
m_pPartManager->GetLightProfileCounts().ResetFrameTicks();
if (passInfo.IsGeneralPass() && m_pPartManager)
m_pPartManager->Update();
....
}
The m_pPartManager pointer is dereferenced and then checked.
Example 2
V595 The 'gEnv->p3DEngine' pointer was utilized before it was verified against nullptr. Check lines:
1477, 1480. gameserialize.cpp 1477
bool CGameSerialize::LoadLevel(....)
{
....
// can quick-load
if (!gEnv->p3DEngine->RestoreTerrainFromDisk())
return false;
if (gEnv->p3DEngine)
{
gEnv->p3DEngine->ResetPostEffects();
}
....
}
The gEnv->p3DEngine pointer is dereferenced and then checked.
Example 3
V595 The 'pSpline' pointer was utilized before it was verified against nullptr. Check lines: 158, 161.
facechannelkeycleanup.cpp 158
void FaceChannel::CleanupKeys(....)
{
CFacialAnimChannelInterpolator backupSpline(*pSpline);
// Create the key entries array.
int numKeys = (pSpline ? pSpline->num_keys() : 0);
....
}
The pSpline pointer is dereferenced and then checked.
21. Miscellaneous
V622 Consider inspecting the 'switch' statement. It's possible that the first 'case' operator is missing.
mergedmeshrendernode.cpp 999
static inline void ExtractSphereSet(....)
{
....
switch (statusPos.pGeom->GetType())
{
if (false)
{
case GEOM_CAPSULE:
statusPos.pGeom->GetPrimitive(0, &cylinder);
}
if (false)
{
case GEOM_CYLINDER:
statusPos.pGeom->GetPrimitive(0, &cylinder);
}
for (int i = 0; i < 2 && ....; ++i)
{
....
}
break;
....
}
This fragment is probably the strangest of all found in CryEngine V. Whether or not the case label will be
selected does not depend on the if statement, even in case of if (false). In the switch statement, an
unconditional jump to the label occurs if the condition of the switch statement is met. Without the
break statement, one could use such code to "bypass" irrelevant statements, but, again, maintaining
such obscure code isn't easy. One more question is, why does the same code execute when jumping to
the labels GEOM_CAPSULE and GEOM_CYLINDER?
V510 The 'LogError' function is not expected to receive class-type variable as second actual argument.
behaviortreenodes_action.cpp 143
typedef CryStringT<char> string;
// The actual fragment name.
22. string m_fragName;
//! cast to C string.
const value_type* c_str() const { return m_str; }
const value_type* data() const { return m_str; };
void LogError(const char* format, ...) const
{ .... }
void QueueAction(const UpdateContext& context)
{
....
ErrorReporter(*this, context).LogError("....'%s'", m_fragName);
....
}
When it is impossible to specify the number and types of all acceptable parameters to a function, one
puts ellipsis (...) at the end of the list of parameters in the function declaration, which means "and
perhaps a few more". Only POD (Plain Old Data) types can be used as actual parameters to the ellipsis. If
an object of a class is passed as an argument to a function's ellipsis, it almost always signals the
presence of a bug. In the code above, it is the contents of the object that get to the stack, not the
pointer to a string. Such code results in forming "gibberish" in the buffer or a crash. The code of
CryEngine V uses a string class of its own, and it already has an appropriate method, c_str().
The fixed version:
LogError("....'%s'", m_fragName.c_str();
A few more suspicious fragments:
V510 The 'LogError' function is not expected to receive class-type variable as second actual
argument. behaviortreenodes_core.cpp 1339
V510 The 'Format' function is not expected to receive class-type variable as second actual
argument. behaviortreenodes_core.cpp 2648
V510 The 'CryWarning' function is not expected to receive class-type variable as sixth actual
argument. crypak.cpp 3324
V510 The 'CryWarning' function is not expected to receive class-type variable as fifth actual
argument. crypak.cpp 3333
V510 The 'CryWarning' function is not expected to receive class-type variable as fifth actual
argument. shaderfxparsebin.cpp 4864
V510 The 'CryWarning' function is not expected to receive class-type variable as fifth actual
argument. shaderfxparsebin.cpp 4931
V510 The 'Format' function is not expected to receive class-type variable as third actual
argument. featuretester.cpp 1727
V529 Odd semicolon ';' after 'for' operator. boolean3d.cpp 1314
int CTriMesh::Slice(....)
{
....
bop_meshupdate *pmd = new bop_meshupdate, *pmd0;
pmd->pMesh[0]=pmd->pMesh[1] = this; AddRef();AddRef();
for(pmd0=m_pMeshUpdate; pmd0->next; pmd0=pmd0->next); // <=
pmd0->next = pmd;
....
23. }
This code is very strange. The programmer put a semicolon after the for loop, while the code formatting
suggests that it should have a body.
V535 The variable 'j' is being used for this loop and for the outer loop. Check lines: 3447, 3490.
physicalworld.cpp 3490
void CPhysicalWorld::SimulateExplosion(....)
{
....
for(j=0;j<pmd->nIslands;j++) // <= line 3447
{
....
for(j=0;j<pcontacts[ncont].nborderpt;j++) // <= line 3490
{
....
}
The project's code is full of other unsafe fragments; for example, there are cases of using one counter
for both nested and outer loops. Large source files contain code with intricate formatting and fragments
where the same variables are changed in different parts of the code - you just can't do without static
analysis there!
A few more strange loops:
V535 The variable 'i' is being used for this loop and for the outer loop. Check lines: 1630, 1683.
entity.cpp 1683
V535 The variable 'i1' is being used for this loop and for the outer loop. Check lines: 1521, 1576.
softentity.cpp 1576
V535 The variable 'i' is being used for this loop and for the outer loop. Check lines: 2315, 2316.
physicalentity.cpp 2316
V535 The variable 'i' is being used for this loop and for the outer loop. Check lines: 1288, 1303.
shadercache.cpp 1303
V539 Consider inspecting iterators which are being passed as arguments to function 'erase'.
frameprofilerender.cpp 1090
float CFrameProfileSystem::RenderPeaks()
{
....
std::vector<SPeakRecord>& rPeaks = m_peaks;
// Go through all peaks.
for (int i = 0; i < (int)rPeaks.size(); i++)
{
....
if (age > fHotToColdTime)
{
rPeaks.erase(m_peaks.begin() + i); // <=
i--;
}
....
}
24. The analyzer suspected that the function handling a container would receive an iterator from another
container. It's a wrong assumption, and there is no error here: the rPeaks variable is a reference to
m_peaks. This code, however, may confuse not only the analyzer, but also other programmers who will
maintain it. One shouldn't write code in a way like that.
V713 The pointer pCollision was utilized in the logical expression before it was verified against nullptr in
the same logical expression. actiongame.cpp 4235
int CActionGame::OnCollisionImmediate(const EventPhys* pEvent)
{
....
else if (pMat->GetBreakability() == 2 &&
pCollision->idmat[0] != pCollision->idmat[1] &&
(energy = pMat->GetBreakEnergy()) > 0 &&
pCollision->mass[0] * 2 > energy &&
....
pMat->GetHitpoints() <= FtoI(min(1E6f, hitenergy / energy)) &&
pCollision) // <=
return 0;
....
}
The if statement includes a rather lengthy conditional expression where the pCollision pointer is used
multiple times. What is wrong about this code is that the pointer is tested for null at the very end, i.e.
after multiple dereference operations.
V758 The 'commandList' reference becomes invalid when smart pointer returned by a function is
destroyed. renderitemdrawer.cpp 274
typedef std::shared_ptr<....> CDeviceGraphicsCommandListPtr;
CDeviceGraphicsCommandListPtr
CDeviceObjectFactory::GetCoreGraphicsCommandList() const
{
return m_pCoreCommandList;
}
void CRenderItemDrawer::DrawCompiledRenderItems(....) const
{
....
{
auto& RESTRICT_REFERENCE commandList = *CCryDeviceWrapper::
GetObjectFactory().GetCoreGraphicsCommandList();
passContext....->PrepareRenderPassForUse(commandList);
}
....
}
The commandList variable receives a reference to the value stored in a smart pointer. When this pointer
destroys the object, the reference will become invalid.
A few more issues of this type:
V758 The 'commandList' reference becomes invalid when smart pointer returned by a function
is destroyed. renderitemdrawer.cpp 384
25. V758 The 'commandList' reference becomes invalid when smart pointer returned by a function
is destroyed. renderitemdrawer.cpp 368
V758 The 'commandList' reference becomes invalid when smart pointer returned by a function
is destroyed. renderitemdrawer.cpp 485
V758 The 'commandList' reference becomes invalid when smart pointer returned by a function
is destroyed. renderitemdrawer.cpp 553
Conclusion
It costs almost nothing to fix bugs caught during the coding phase unlike those that get to the testers,
while fixing bugs that have made it to the end users involves huge expenses. No matter what analyzer
you use, the static analysis technology itself has long proved to be an extremely effective and efficient
means to control the quality of program code and software products in general.
Our collaboration with Epic Games has shown very well how integration of our analyzer into Unreal
Engine 4 has benefited the project. We helped the developers in every aspect of analyzer integration
and even fixed the bugs found in the project so that the developer team could continue scanning new
code regularly on their own. It's this kind of collaboration that we would like to try with Crytek.
Welcome to try PVS-Studio on your C/C++/C# project.