SlideShare una empresa de Scribd logo
1 de 10
Descargar para leer sin conexión
An Experiment with Checking the glibc 
Library 
Author: Andrey Karpov 
Date: 26.02.2014 
We have recently carried out an experiment with checking the glibc library by PVS-Studio. Its purpose 
was to study how good our analyzer is at checking Linux-projects. The basic conclusion is, not much 
good yet. Non-standard extensions used in such projects make the analyzer generate a huge pile of false 
positives. However, we have found some interesting bugs. 
glibc 
glibc - is the GNU Project's implementation of the C standard library. Originally written by the Free 
Software Foundation (FSF) for the GNU operating system. 
Released under the GNU Lesser General Public License, glibc is free software. 
The description is taken from the Wikipedia article: glibc. 
Not long ago, the release of a new version of the glibc library was announced. It prompted us to check 
this library with our analyzer PVS-Studio. Unfortunately, I was busy with another task for the last two 
weeks and got the opportunity to write the article about that check only now. I was actually engaged in 
carrying out a thorough comparison of several static analyzers and then writing a large article about the 
results of that comparison. This undertaking is very important for us because people are constantly 
asking about the differences between our analyzer and Cppcheck and Visual Studio 2013's static 
analyzer. So glibc (glibc-2-19-90) had to wait a while before I could finally get down to it. 
We were not expecting to find anything terrible there - and we haven't. The glibc library is very high-quality 
and it is regularly checked by many analyzers, among which are at least the following ones: 
• Coverity; 
• Clang; 
• Cppcheck. 
So it would be a large success to find at least one bug in its code.
Difficulties of analysis 
Those not familiar with the internal mechanisms and principles of static analysis tools may view them as 
very simple utilities. It's a mistake. These are very complex programs. 
There are tools like RATS that may confuse you. If you take a look at RATS' code, you'll see that it merely 
searches for certain function names in files. Tools like that are called static code analyzers too, but their 
job is actually very far from what real static code analyzers do. Static analysis has nothing to do with a 
search with regular expressions [1]. 
We already mentioned a number of times that a Linux-version of an application is absolutely not the 
same thing as a recompiled executable module [2]. There is a huge gulf between an executable module 
and a ready software product. One of the obstacles one faces when making a Linux-version is the need 
to support specific extensions and things like that. 
An ordinary programmer who has never dealt with all those aspects doesn't have a slightest idea of how 
difficult and huge this work is. For example, take a call of the strcmp() function: 
cmpres = strcmp (newp->from_string, root->from_string); 
An ordinary programmer doesn't even suspect which terrible code this single line will turn into after the 
preprocessing and which non-standard extensions will be used in it. Particularly in this case, the line 
above turns into the following stuff: 
cmpres = __extension__ ({ size_t __s1_len, __s2_len; 
(__builtin_constant_p (newp->from_string) && 
__builtin_constant_p (root->from_string) && 
(__s1_len = strlen (newp->from_string), 
__s2_len = strlen (root->from_string), 
(!((size_t)(const void *)((newp->from_string) + 1) - 
(size_t)(const void *)(newp->from_string) == 1) || 
__s1_len >= 4) && 
(!((size_t)(const void *)((root->from_string) + 1) - 
(size_t)(const void *)(root->from_string) == 1) || 
__s2_len >= 4)) ? 
__builtin_strcmp (newp->from_string, root->from_string) : 
(__builtin_constant_p (newp->from_string) && 
((size_t)(const void *)((newp->from_string) + 1) - 
(size_t)(const void *)(newp->from_string) == 1) && 
(__s1_len = strlen (newp->from_string), __s1_len < 4) ? 
(__builtin_constant_p (root->from_string) &&
((size_t)(const void *)((root->from_string) + 1) - 
(size_t)(const void *)(root->from_string) == 1) ? 
__builtin_strcmp (newp->from_string, root->from_string) : 
(__extension__ ({ const unsigned char *__s2 = 
(const unsigned char *) (const char *) (root->from_string); 
int __result = (((const unsigned char *) (const char *) 
(newp->from_string))[0] - __s2[0]); 
if (__s1_len > 0 && __result == 0) { 
__result = (((const unsigned char *) (const char *) 
(newp->from_string))[1] - __s2[1]); 
if (__s1_len > 1 && __result == 0) { __result = 
(((const unsigned char *) (const char *) 
(newp->from_string))[2] - __s2[2]); 
if (__s1_len > 2 && __result == 0) 
__result = (((const unsigned char *) 
(const char *) (newp->from_string))[3] - 
__s2[3]); } } __result; }))) : 
(__builtin_constant_p (root->from_string) && 
((size_t)(const void *)((root->from_string) + 1) - 
(size_t)(const void *)(root->from_string) == 1) && 
(__s2_len = strlen (root->from_string), __s2_len < 4) ? 
(__builtin_constant_p (newp->from_string) && 
((size_t)(const void *)((newp->from_string) + 1) -/ 
(size_t)(const void *)(newp->from_string) == 1) ? 
__builtin_strcmp (newp->from_string, root->from_string) : 
(- (__extension__ ({ const unsigned char *__s2 = 
(const unsigned char *) (const char *) (newp->from_string); 
int __result = (((const unsigned char *) (const char *) 
(root->from_string))[0] - __s2[0]); 
if (__s2_len > 0 && __result == 0) { __result =
(((const unsigned char *) (const char *) 
(root->from_string))[1] - __s2[1]); 
if (__s2_len > 1 && __result == 0) 
{ __result = (((const unsigned char *) 
(const char *) (root->from_string))[2] - 
__s2[2]); if (__s2_len > 2 && __result == 0) 
__result = (((const unsigned char *) (const char *) 
(root->from_string))[3] - __s2[3]); } } __result; })))) : 
__builtin_strcmp (newp->from_string, root->from_string)))); 
}); 
The analyzer is not ready for such a turn-up and starts generating silly false positives on such constructs. 
Let me explain this point about false positives by a simpler example. Assume we have the following line 
of code: 
assert(MAP_FAILED == (void *) -1); 
The assert() macro expands into the following fragment: 
((((void *) -1) == (void *) -1) ? (void) (0) : 
__assert_fail ("((void *) -1) == (void *) -1", 
"loadmsgcat.c", 840, __PRETTY_FUNCTION__)); 
The PVS-Studio analyzer generates a false positive on the comparison (((void *) -1) == (void *) -1): 
V501 There are identical sub-expressions to the left and to the right of the '==' operator: ((void *) - 1) == 
(void *) - 1 loadmsgcat.c 840 
There is nothing to be surprised at. We have already been through all that stuff when adapting our tool 
for applications built with Visual C++. There is quite a lot to wonder at there, too. It takes you much time 
and effort to teach the analyzer to understand all those nuances. You have to teach it to understand 
that it is dealing with the macro "assert" which is harmless and whose job is but to check that the 
MAP_FAILED macro equals "(void *) -1". We have already done all that for Visual C++, but not for Linux. 
It is teaching the analyzer to correctly handle such constructs that makes up the hugest part of work on 
supporting other compilers. This work is invisible to others, but it really requires you to thoroughly 
investigate, support and test all the nuances of the compiler and standard libraries. 
I've just slightly opened this door to Hell for you to peek in. I'm going to write a series of articles soon to 
show all the difficulties of static analysis tools' development. Sure you'll like them.
Suspicious code fragments found in the glibc library 
Although glibc is tested by many tools, we still have managed to find a few interesting bugs. Let's take a 
look at them. 
A strange expression 
char *DCIGETTEXT (....) 
{ 
.... 
/* Make CATEGORYVALUE point to the next element of the list. */ 
while (categoryvalue[0] != '0' && categoryvalue[0] == ':') 
++categoryvalue; 
.... 
} 
V590 Consider inspecting this expression. The expression is excessive or contains a misprint. dcigettext.c 
582 
The condition can be shortened: 
while (categoryvalue[0] == ':') 
Perhaps there is no error here and the first part of the (categoryvalue[0] != '0') condition is simply 
redundant. But I suspect the error is real and the code should look like this: 
while (categoryvalue[0] != '0' && categoryvalue[0] != ':') 
Dereferencing a pointer before checking it 
This fragment is not necessarily unsafe - perhaps the pointer can never be null. But I should mention it 
anyway: 
static enum clnt_stat 
clntraw_call (h, proc, xargs, argsp, xresults, resultsp, timeout) 
CLIENT *h; 
u_long proc; 
xdrproc_t xargs; 
caddr_t argsp; 
xdrproc_t xresults; 
caddr_t resultsp;
struct timeval timeout; 
{ 
struct clntraw_private_s *clp = clntraw_private; 
XDR *xdrs = &clp->xdr_stream; 
.... 
if (clp == NULL) 
return RPC_FAILED; 
.... 
} 
V595 The 'clp' pointer was utilized before it was verified against nullptr. Check lines: 145, 150. 
clnt_raw.c 145 
In the same file, not far from this piece, there is a similar defect: V595 The 'clp' pointer was utilized 
before it was verified against nullptr. Check lines: 232, 235. clnt_raw.c 232 
Dangerous optimization (a vulnerability) 
char * 
__sha256_crypt_r (key, salt, buffer, buflen) 
const char *key; 
const char *salt; 
char *buffer; 
int buflen; 
{ 
.... 
unsigned char temp_result[32] 
.... 
memset (temp_result, '0', sizeof (temp_result)); 
.... 
.... // temp_result not used further on 
} 
V597 The compiler could delete the 'memset' function call, which is used to flush 'temp_result' buffer. 
The RtlSecureZeroMemory() function should be used to erase the private data. sha256-crypt.c 385
The compiler is allowed to remove the call of the memset() function when compiling the Release 
version. Well, it is actually obliged to do so for the sake of optimization. Since the 'temp_result' buffer is 
not used anywhere after calling the memset() function, the function call itself is not needed too. 
This is a vulnerability because the private data will not be erased. The memset() function should be 
replaced with a more appropriate one. The analyzer suggests RtlSecureZeroMemory(), which is absent in 
Linux of course. But there are other alternatives. 
The same defect: V597 The compiler could delete the 'memset' function call, which is used to flush 
'temp_result' buffer. The RtlSecureZeroMemory() function should be used to erase the private data. 
sha512-crypt.c 396 
Undefined behavior 
One might expect the glibc library's code to be written in such a way as to provide maximum portability. 
However, there are quite a lot of shift constructs in it, which can't be safe from the viewpoint of 
portability. 
This is what the C language standard has to say about shifts: 
The integer promotions are performed on each of the operands. The type of the result is that of the 
promoted left operand. If the value of the right operand is negative or is greater than or equal to the 
width of the promoted left operand, the behavior is undefined. 
The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with zeros. If E1 has an 
unsigned type, the value of the result is E1 * 2 pow E2, reduced modulo one more than the maximum 
value representable in the result type. If E1 has a signed type and nonnegative value, and E1 * 2 pow E2 
is representable in the result type, then that is the resulting value; otherwise, the behavior is undefined. 
5 The result of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type or if E1 has a 
signed type and a nonnegative value, the value of the result is the integral part of the quotient of E1 / 2 
pow E2. If E1 has a signed type and a negative value, the resulting value is implementation-defined. 
It follows from this text that it is illegal to shift negative numbers. However, it is a very common 
operation in the glibc library. 
An example of left shift: 
static void init_cacheinfo (void) 
{ 
.... 
count_mask = ~(-1 << (count_mask + 1)); 
.... 
} 
V610 Undefined behavior. Check the shift operator '<<. The left operand '-1' is negative. cacheinfo.c 645
An example of right shift: 
utf8_encode (char *buf, int val) 
{ 
.... 
*buf = (unsigned char) (~0xff >> step); 
.... 
} 
The "~0xff" expression is of the 'int' type and equals -256. 
Below is a list of all the code fragments with incorrect shift operations: 
• strxfrm_l.c 68 
• clock_nanosleep.c 38 
• ifaddrs.c 786 
• xdr_intXX_t.c 35 
• xdr_intXX_t.c 41 
• private.h 327 
• private.h 331 
• zic.c 696 
• zdump.c 212 
• zdump.c 216 
• timer_create.c 47 
• timer_create.c 49 
• loop.c 331 
• loop.c 437 
• mktime.c 207 
• mktime.c 208 
• mktime.c 211 
• mktime.c 212 
• mktime.c 230 
• mktime.c 298 
• mktime.c 298 
• ld-collate.c 298 
Using an uninitialized variable 
static int send_vc(....) 
{ 
....
int truncating, connreset, resplen, n; 
.... 
#ifdef _STRING_ARCH_unaligned 
*anssizp2 = orig_anssizp - resplen; 
*ansp2 = *ansp + resplen; 
#else 
.... 
} 
V614 Uninitialized variable 'resplen' used. res_send.c 790 
Incorrect string formatting 
In some fragments, '%u' is used to print signed variables, and in some other fragments, '%d' is used to 
print unsigned variables. These are trifles, of course, but they are worth mentioning. 
For example: 
typedef unsigned int __uid_t; 
typedef __uid_t uid_t; 
int 
user2netname (...., const uid_t uid, ....) 
{ 
.... 
sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom); 
.... 
} 
V576 Incorrect format. Consider checking the fourth actual argument of the 'sprintf' function. The 
SIGNED integer type argument is expected. netname.c 51 
Other defects of this kind: 
• Consider checking the second actual argument of the 'printf' function. The SIGNED integer type 
argument is expected. locarchive.c 1741 
• Consider checking the fourth actual argument of the 'printf' function. The SIGNED integer type 
argument is expected. locarchive.c 1741
• Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type 
argument is expected. res_debug.c 236 
• Consider checking the third actual argument of the 'sprintf' function. The UNSIGNED integer 
type argument is expected. inet_net_ntop.c 134 
• Consider checking the fourth actual argument of the 'sprintf' function. The SIGNED integer type 
argument is expected. ns_print.c 500 
• Consider checking the fifth actual argument of the 'sprintf' function. The SIGNED integer type 
argument is expected. ns_print.c 500 
• Consider checking the third actual argument of the 'sprintf' function. The SIGNED integer type 
argument is expected. ns_print.c 572 
• Consider checking the fourth actual argument of the 'sprintf' function. The SIGNED integer type 
argument is expected. ns_print.c 572 
• Consider checking the fifth actual argument of the 'sprintf' function. The SIGNED integer type 
argument is expected. ns_print.c 572 
• Consider checking the third actual argument of the 'sprintf' function. The UNSIGNED integer 
type argument is expected. ns_print.c 628 
• Consider checking the fourth actual argument of the 'sprintf' function. The UNSIGNED integer 
type argument is expected. ns_print.c 628 
• Consider checking the fifth actual argument of the 'sprintf' function. The UNSIGNED integer type 
argument is expected. ns_print.c 628 
• Consider checking the third actual argument of the 'sprintf' function. The SIGNED integer type 
argument is expected. ns_print.c 645 
• Consider checking the third actual argument of the 'sprintf' function. The UNSIGNED integer 
type argument is expected. ns_print.c 685 
• Consider checking the second actual argument of the 'printf' function. The SIGNED integer type 
argument is expected. nis_print.c 209 
• Consider checking the second actual argument of the 'printf' function. The SIGNED integer type 
argument is expected. sprof.c 480 
Conclusion 
We should admit that we made a wrong choice for the experiment with testing our analyzer on code 
from the Linux world - the glibc project is just too high-quality. :) There are too few worthy defects to 
make the article interesting. But anyway, there are many other well-known and interesting projects 
under Linux waiting to be tested by PVS-Studio to demonstrate its capabilities. 
References 
1. Andrey Karpov. Static analysis and regular expressions. 
2. Dmitry Tkachenko. PVS-Studio and CppCat: An Interview with Andrey Karpov, the Project CTO 
and Developer.

Más contenido relacionado

La actualidad más candente

C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8Christian Nagel
 
PVS-Studio for Linux (CoreHard presentation)
PVS-Studio for Linux (CoreHard presentation)PVS-Studio for Linux (CoreHard presentation)
PVS-Studio for Linux (CoreHard presentation)Andrey Karpov
 
The operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzerThe operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzerAndrey Karpov
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in JavaDoug Hawkins
 
Дмитрий Нестерук, Паттерны проектирования в XXI веке
Дмитрий Нестерук, Паттерны проектирования в XXI векеДмитрий Нестерук, Паттерны проектирования в XXI веке
Дмитрий Нестерук, Паттерны проектирования в XXI векеSergey Platonov
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupDror Helper
 
модели акторов в с++ миф или реальность
модели акторов в с++ миф или реальностьмодели акторов в с++ миф или реальность
модели акторов в с++ миф или реальностьcorehard_by
 
Functional Reactive Programming (FRP): Working with RxJS
Functional Reactive Programming (FRP): Working with RxJSFunctional Reactive Programming (FRP): Working with RxJS
Functional Reactive Programming (FRP): Working with RxJSOswald Campesato
 
Reactive programming with RxAndroid
Reactive programming with RxAndroidReactive programming with RxAndroid
Reactive programming with RxAndroidSavvycom Savvycom
 
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesAndrey Karpov
 
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...Andrey Karpov
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxDavid Rodenas
 
How Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzerHow Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzerAndrey Karpov
 
2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - englishJen Yee Hong
 
200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis Experience200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis ExperienceAndrey Karpov
 
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJSBrainhub
 
Rechecking SharpDevelop: Any New Bugs?
Rechecking SharpDevelop: Any New Bugs?Rechecking SharpDevelop: Any New Bugs?
Rechecking SharpDevelop: Any New Bugs?PVS-Studio
 

La actualidad más candente (20)

C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8
 
PVS-Studio for Linux (CoreHard presentation)
PVS-Studio for Linux (CoreHard presentation)PVS-Studio for Linux (CoreHard presentation)
PVS-Studio for Linux (CoreHard presentation)
 
The operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzerThe operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzer
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in Java
 
Дмитрий Нестерук, Паттерны проектирования в XXI веке
Дмитрий Нестерук, Паттерны проектирования в XXI векеДмитрий Нестерук, Паттерны проектирования в XXI веке
Дмитрий Нестерук, Паттерны проектирования в XXI веке
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
 
модели акторов в с++ миф или реальность
модели акторов в с++ миф или реальностьмодели акторов в с++ миф или реальность
модели акторов в с++ миф или реальность
 
Functional Reactive Programming (FRP): Working with RxJS
Functional Reactive Programming (FRP): Working with RxJSFunctional Reactive Programming (FRP): Working with RxJS
Functional Reactive Programming (FRP): Working with RxJS
 
Reactive programming with RxAndroid
Reactive programming with RxAndroidReactive programming with RxAndroid
Reactive programming with RxAndroid
 
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error Examples
 
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...
 
Introduzione al TDD
Introduzione al TDDIntroduzione al TDD
Introduzione al TDD
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicox
 
How Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzerHow Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzer
 
2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
 
200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis Experience200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis Experience
 
The Rust Borrow Checker
The Rust Borrow CheckerThe Rust Borrow Checker
The Rust Borrow Checker
 
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJS
 
Rechecking SharpDevelop: Any New Bugs?
Rechecking SharpDevelop: Any New Bugs?Rechecking SharpDevelop: Any New Bugs?
Rechecking SharpDevelop: Any New Bugs?
 

Destacado

Using Blogs to Generate and Nurture Demand into Closed Business
Using Blogs to Generate and Nurture Demand into Closed BusinessUsing Blogs to Generate and Nurture Demand into Closed Business
Using Blogs to Generate and Nurture Demand into Closed BusinessCompendium
 
Media Studies Evaluation
Media Studies EvaluationMedia Studies Evaluation
Media Studies Evaluationnmimic1991
 
The State of Mobile Content Marketing Webinar: Compendium & ExactTarget
The State of Mobile Content Marketing Webinar: Compendium & ExactTargetThe State of Mobile Content Marketing Webinar: Compendium & ExactTarget
The State of Mobile Content Marketing Webinar: Compendium & ExactTargetCompendium
 
Why You Don't Have Enough Content, and How to Find More | Jay Baer & Chris Ba...
Why You Don't Have Enough Content, and How to Find More | Jay Baer & Chris Ba...Why You Don't Have Enough Content, and How to Find More | Jay Baer & Chris Ba...
Why You Don't Have Enough Content, and How to Find More | Jay Baer & Chris Ba...Compendium
 
The 9 Most Horrifying Content Marketing Misunderstandings
The 9 Most Horrifying Content Marketing MisunderstandingsThe 9 Most Horrifying Content Marketing Misunderstandings
The 9 Most Horrifying Content Marketing MisunderstandingsCompendium
 

Destacado (6)

Using Blogs to Generate and Nurture Demand into Closed Business
Using Blogs to Generate and Nurture Demand into Closed BusinessUsing Blogs to Generate and Nurture Demand into Closed Business
Using Blogs to Generate and Nurture Demand into Closed Business
 
Groovy_Grails_Capability
Groovy_Grails_CapabilityGroovy_Grails_Capability
Groovy_Grails_Capability
 
Media Studies Evaluation
Media Studies EvaluationMedia Studies Evaluation
Media Studies Evaluation
 
The State of Mobile Content Marketing Webinar: Compendium & ExactTarget
The State of Mobile Content Marketing Webinar: Compendium & ExactTargetThe State of Mobile Content Marketing Webinar: Compendium & ExactTarget
The State of Mobile Content Marketing Webinar: Compendium & ExactTarget
 
Why You Don't Have Enough Content, and How to Find More | Jay Baer & Chris Ba...
Why You Don't Have Enough Content, and How to Find More | Jay Baer & Chris Ba...Why You Don't Have Enough Content, and How to Find More | Jay Baer & Chris Ba...
Why You Don't Have Enough Content, and How to Find More | Jay Baer & Chris Ba...
 
The 9 Most Horrifying Content Marketing Misunderstandings
The 9 Most Horrifying Content Marketing MisunderstandingsThe 9 Most Horrifying Content Marketing Misunderstandings
The 9 Most Horrifying Content Marketing Misunderstandings
 

Similar a An Experiment with Checking the GNU C Library (glibc) Reveals Bugs and Analysis Challenges

Checking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-StudioChecking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-StudioAndrey Karpov
 
Tesseract. Recognizing Errors in Recognition Software
Tesseract. Recognizing Errors in Recognition SoftwareTesseract. Recognizing Errors in Recognition Software
Tesseract. Recognizing Errors in Recognition SoftwareAndrey Karpov
 
A fresh eye on Oracle VM VirtualBox
A fresh eye on Oracle VM VirtualBoxA fresh eye on Oracle VM VirtualBox
A fresh eye on Oracle VM VirtualBoxPVS-Studio
 
Looking for Bugs in MonoDevelop
Looking for Bugs in MonoDevelopLooking for Bugs in MonoDevelop
Looking for Bugs in MonoDevelopPVS-Studio
 
PVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd CheckPVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd CheckAndrey Karpov
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project AnalyzedPVS-Studio
 
PVS-Studio delved into the FreeBSD kernel
PVS-Studio delved into the FreeBSD kernelPVS-Studio delved into the FreeBSD kernel
PVS-Studio delved into the FreeBSD kernelPVS-Studio
 
Linux Kernel, tested by the Linux-version of PVS-Studio
Linux Kernel, tested by the Linux-version of PVS-StudioLinux Kernel, tested by the Linux-version of PVS-Studio
Linux Kernel, tested by the Linux-version of PVS-StudioPVS-Studio
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingAndrey Karpov
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingPVS-Studio
 
Zero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for youZero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for youAndrey Karpov
 
LibRaw, Coverity SCAN, PVS-Studio
LibRaw, Coverity SCAN, PVS-StudioLibRaw, Coverity SCAN, PVS-Studio
LibRaw, Coverity SCAN, PVS-StudioAndrey Karpov
 
The Little Unicorn That Could
The Little Unicorn That CouldThe Little Unicorn That Could
The Little Unicorn That CouldPVS-Studio
 
Analyzing the Blender project with PVS-Studio
Analyzing the Blender project with PVS-StudioAnalyzing the Blender project with PVS-Studio
Analyzing the Blender project with PVS-StudioPVS-Studio
 
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017Andrey Karpov
 
Mathematicians: Trust, but Verify
Mathematicians: Trust, but VerifyMathematicians: Trust, but Verify
Mathematicians: Trust, but VerifyAndrey Karpov
 
PVS-Studio: analyzing ReactOS's code
PVS-Studio: analyzing ReactOS's codePVS-Studio: analyzing ReactOS's code
PVS-Studio: analyzing ReactOS's codePVS-Studio
 
CppCat Static Analyzer Review
CppCat Static Analyzer ReviewCppCat Static Analyzer Review
CppCat Static Analyzer ReviewAndrey Karpov
 
Headache from using mathematical software
Headache from using mathematical softwareHeadache from using mathematical software
Headache from using mathematical softwarePVS-Studio
 
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-StudioArcheology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-StudioAndrey Karpov
 

Similar a An Experiment with Checking the GNU C Library (glibc) Reveals Bugs and Analysis Challenges (20)

Checking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-StudioChecking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-Studio
 
Tesseract. Recognizing Errors in Recognition Software
Tesseract. Recognizing Errors in Recognition SoftwareTesseract. Recognizing Errors in Recognition Software
Tesseract. Recognizing Errors in Recognition Software
 
A fresh eye on Oracle VM VirtualBox
A fresh eye on Oracle VM VirtualBoxA fresh eye on Oracle VM VirtualBox
A fresh eye on Oracle VM VirtualBox
 
Looking for Bugs in MonoDevelop
Looking for Bugs in MonoDevelopLooking for Bugs in MonoDevelop
Looking for Bugs in MonoDevelop
 
PVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd CheckPVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd Check
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project Analyzed
 
PVS-Studio delved into the FreeBSD kernel
PVS-Studio delved into the FreeBSD kernelPVS-Studio delved into the FreeBSD kernel
PVS-Studio delved into the FreeBSD kernel
 
Linux Kernel, tested by the Linux-version of PVS-Studio
Linux Kernel, tested by the Linux-version of PVS-StudioLinux Kernel, tested by the Linux-version of PVS-Studio
Linux Kernel, tested by the Linux-version of PVS-Studio
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and Everything
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and Everything
 
Zero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for youZero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for you
 
LibRaw, Coverity SCAN, PVS-Studio
LibRaw, Coverity SCAN, PVS-StudioLibRaw, Coverity SCAN, PVS-Studio
LibRaw, Coverity SCAN, PVS-Studio
 
The Little Unicorn That Could
The Little Unicorn That CouldThe Little Unicorn That Could
The Little Unicorn That Could
 
Analyzing the Blender project with PVS-Studio
Analyzing the Blender project with PVS-StudioAnalyzing the Blender project with PVS-Studio
Analyzing the Blender project with PVS-Studio
 
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
 
Mathematicians: Trust, but Verify
Mathematicians: Trust, but VerifyMathematicians: Trust, but Verify
Mathematicians: Trust, but Verify
 
PVS-Studio: analyzing ReactOS's code
PVS-Studio: analyzing ReactOS's codePVS-Studio: analyzing ReactOS's code
PVS-Studio: analyzing ReactOS's code
 
CppCat Static Analyzer Review
CppCat Static Analyzer ReviewCppCat Static Analyzer Review
CppCat Static Analyzer Review
 
Headache from using mathematical software
Headache from using mathematical softwareHeadache from using mathematical software
Headache from using mathematical software
 
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-StudioArcheology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
 

Más de Andrey Karpov

60 антипаттернов для С++ программиста
60 антипаттернов для С++ программиста60 антипаттернов для С++ программиста
60 антипаттернов для С++ программистаAndrey Karpov
 
60 terrible tips for a C++ developer
60 terrible tips for a C++ developer60 terrible tips for a C++ developer
60 terrible tips for a C++ developerAndrey Karpov
 
Ошибки, которые сложно заметить на code review, но которые находятся статичес...
Ошибки, которые сложно заметить на code review, но которые находятся статичес...Ошибки, которые сложно заметить на code review, но которые находятся статичес...
Ошибки, которые сложно заметить на code review, но которые находятся статичес...Andrey Karpov
 
PVS-Studio in 2021 - Feature Overview
PVS-Studio in 2021 - Feature OverviewPVS-Studio in 2021 - Feature Overview
PVS-Studio in 2021 - Feature OverviewAndrey Karpov
 
PVS-Studio в 2021 - Примеры ошибок
PVS-Studio в 2021 - Примеры ошибокPVS-Studio в 2021 - Примеры ошибок
PVS-Studio в 2021 - Примеры ошибокAndrey Karpov
 
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...Andrey Karpov
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesAndrey Karpov
 
Does static analysis need machine learning?
Does static analysis need machine learning?Does static analysis need machine learning?
Does static analysis need machine learning?Andrey Karpov
 
Typical errors in code on the example of C++, C#, and Java
Typical errors in code on the example of C++, C#, and JavaTypical errors in code on the example of C++, C#, and Java
Typical errors in code on the example of C++, C#, and JavaAndrey Karpov
 
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)Andrey Karpov
 
Game Engine Code Quality: Is Everything Really That Bad?
Game Engine Code Quality: Is Everything Really That Bad?Game Engine Code Quality: Is Everything Really That Bad?
Game Engine Code Quality: Is Everything Really That Bad?Andrey Karpov
 
C++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerC++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerAndrey Karpov
 
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source SoftwareThe Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source SoftwareAndrey Karpov
 
Static Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal EngineStatic Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal EngineAndrey Karpov
 
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsSafety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsAndrey Karpov
 
The Great and Mighty C++
The Great and Mighty C++The Great and Mighty C++
The Great and Mighty C++Andrey Karpov
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?Andrey Karpov
 
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOpsPVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOpsAndrey Karpov
 
PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...
PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...
PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...Andrey Karpov
 

Más de Andrey Karpov (20)

60 антипаттернов для С++ программиста
60 антипаттернов для С++ программиста60 антипаттернов для С++ программиста
60 антипаттернов для С++ программиста
 
60 terrible tips for a C++ developer
60 terrible tips for a C++ developer60 terrible tips for a C++ developer
60 terrible tips for a C++ developer
 
Ошибки, которые сложно заметить на code review, но которые находятся статичес...
Ошибки, которые сложно заметить на code review, но которые находятся статичес...Ошибки, которые сложно заметить на code review, но которые находятся статичес...
Ошибки, которые сложно заметить на code review, но которые находятся статичес...
 
PVS-Studio in 2021 - Feature Overview
PVS-Studio in 2021 - Feature OverviewPVS-Studio in 2021 - Feature Overview
PVS-Studio in 2021 - Feature Overview
 
PVS-Studio в 2021 - Примеры ошибок
PVS-Studio в 2021 - Примеры ошибокPVS-Studio в 2021 - Примеры ошибок
PVS-Studio в 2021 - Примеры ошибок
 
PVS-Studio в 2021
PVS-Studio в 2021PVS-Studio в 2021
PVS-Studio в 2021
 
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' Mistakes
 
Does static analysis need machine learning?
Does static analysis need machine learning?Does static analysis need machine learning?
Does static analysis need machine learning?
 
Typical errors in code on the example of C++, C#, and Java
Typical errors in code on the example of C++, C#, and JavaTypical errors in code on the example of C++, C#, and Java
Typical errors in code on the example of C++, C#, and Java
 
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
 
Game Engine Code Quality: Is Everything Really That Bad?
Game Engine Code Quality: Is Everything Really That Bad?Game Engine Code Quality: Is Everything Really That Bad?
Game Engine Code Quality: Is Everything Really That Bad?
 
C++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerC++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical Reviewer
 
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source SoftwareThe Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
 
Static Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal EngineStatic Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal Engine
 
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsSafety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
 
The Great and Mighty C++
The Great and Mighty C++The Great and Mighty C++
The Great and Mighty C++
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?
 
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOpsPVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
 
PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...
PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...
PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...
 

Último

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 

Último (20)

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 

An Experiment with Checking the GNU C Library (glibc) Reveals Bugs and Analysis Challenges

  • 1. An Experiment with Checking the glibc Library Author: Andrey Karpov Date: 26.02.2014 We have recently carried out an experiment with checking the glibc library by PVS-Studio. Its purpose was to study how good our analyzer is at checking Linux-projects. The basic conclusion is, not much good yet. Non-standard extensions used in such projects make the analyzer generate a huge pile of false positives. However, we have found some interesting bugs. glibc glibc - is the GNU Project's implementation of the C standard library. Originally written by the Free Software Foundation (FSF) for the GNU operating system. Released under the GNU Lesser General Public License, glibc is free software. The description is taken from the Wikipedia article: glibc. Not long ago, the release of a new version of the glibc library was announced. It prompted us to check this library with our analyzer PVS-Studio. Unfortunately, I was busy with another task for the last two weeks and got the opportunity to write the article about that check only now. I was actually engaged in carrying out a thorough comparison of several static analyzers and then writing a large article about the results of that comparison. This undertaking is very important for us because people are constantly asking about the differences between our analyzer and Cppcheck and Visual Studio 2013's static analyzer. So glibc (glibc-2-19-90) had to wait a while before I could finally get down to it. We were not expecting to find anything terrible there - and we haven't. The glibc library is very high-quality and it is regularly checked by many analyzers, among which are at least the following ones: • Coverity; • Clang; • Cppcheck. So it would be a large success to find at least one bug in its code.
  • 2. Difficulties of analysis Those not familiar with the internal mechanisms and principles of static analysis tools may view them as very simple utilities. It's a mistake. These are very complex programs. There are tools like RATS that may confuse you. If you take a look at RATS' code, you'll see that it merely searches for certain function names in files. Tools like that are called static code analyzers too, but their job is actually very far from what real static code analyzers do. Static analysis has nothing to do with a search with regular expressions [1]. We already mentioned a number of times that a Linux-version of an application is absolutely not the same thing as a recompiled executable module [2]. There is a huge gulf between an executable module and a ready software product. One of the obstacles one faces when making a Linux-version is the need to support specific extensions and things like that. An ordinary programmer who has never dealt with all those aspects doesn't have a slightest idea of how difficult and huge this work is. For example, take a call of the strcmp() function: cmpres = strcmp (newp->from_string, root->from_string); An ordinary programmer doesn't even suspect which terrible code this single line will turn into after the preprocessing and which non-standard extensions will be used in it. Particularly in this case, the line above turns into the following stuff: cmpres = __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (newp->from_string) && __builtin_constant_p (root->from_string) && (__s1_len = strlen (newp->from_string), __s2_len = strlen (root->from_string), (!((size_t)(const void *)((newp->from_string) + 1) - (size_t)(const void *)(newp->from_string) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((root->from_string) + 1) - (size_t)(const void *)(root->from_string) == 1) || __s2_len >= 4)) ? __builtin_strcmp (newp->from_string, root->from_string) : (__builtin_constant_p (newp->from_string) && ((size_t)(const void *)((newp->from_string) + 1) - (size_t)(const void *)(newp->from_string) == 1) && (__s1_len = strlen (newp->from_string), __s1_len < 4) ? (__builtin_constant_p (root->from_string) &&
  • 3. ((size_t)(const void *)((root->from_string) + 1) - (size_t)(const void *)(root->from_string) == 1) ? __builtin_strcmp (newp->from_string, root->from_string) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (root->from_string); int __result = (((const unsigned char *) (const char *) (newp->from_string))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (newp->from_string))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (newp->from_string))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (newp->from_string))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (root->from_string) && ((size_t)(const void *)((root->from_string) + 1) - (size_t)(const void *)(root->from_string) == 1) && (__s2_len = strlen (root->from_string), __s2_len < 4) ? (__builtin_constant_p (newp->from_string) && ((size_t)(const void *)((newp->from_string) + 1) -/ (size_t)(const void *)(newp->from_string) == 1) ? __builtin_strcmp (newp->from_string, root->from_string) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (newp->from_string); int __result = (((const unsigned char *) (const char *) (root->from_string))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result =
  • 4. (((const unsigned char *) (const char *) (root->from_string))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (root->from_string))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (root->from_string))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (newp->from_string, root->from_string)))); }); The analyzer is not ready for such a turn-up and starts generating silly false positives on such constructs. Let me explain this point about false positives by a simpler example. Assume we have the following line of code: assert(MAP_FAILED == (void *) -1); The assert() macro expands into the following fragment: ((((void *) -1) == (void *) -1) ? (void) (0) : __assert_fail ("((void *) -1) == (void *) -1", "loadmsgcat.c", 840, __PRETTY_FUNCTION__)); The PVS-Studio analyzer generates a false positive on the comparison (((void *) -1) == (void *) -1): V501 There are identical sub-expressions to the left and to the right of the '==' operator: ((void *) - 1) == (void *) - 1 loadmsgcat.c 840 There is nothing to be surprised at. We have already been through all that stuff when adapting our tool for applications built with Visual C++. There is quite a lot to wonder at there, too. It takes you much time and effort to teach the analyzer to understand all those nuances. You have to teach it to understand that it is dealing with the macro "assert" which is harmless and whose job is but to check that the MAP_FAILED macro equals "(void *) -1". We have already done all that for Visual C++, but not for Linux. It is teaching the analyzer to correctly handle such constructs that makes up the hugest part of work on supporting other compilers. This work is invisible to others, but it really requires you to thoroughly investigate, support and test all the nuances of the compiler and standard libraries. I've just slightly opened this door to Hell for you to peek in. I'm going to write a series of articles soon to show all the difficulties of static analysis tools' development. Sure you'll like them.
  • 5. Suspicious code fragments found in the glibc library Although glibc is tested by many tools, we still have managed to find a few interesting bugs. Let's take a look at them. A strange expression char *DCIGETTEXT (....) { .... /* Make CATEGORYVALUE point to the next element of the list. */ while (categoryvalue[0] != '0' && categoryvalue[0] == ':') ++categoryvalue; .... } V590 Consider inspecting this expression. The expression is excessive or contains a misprint. dcigettext.c 582 The condition can be shortened: while (categoryvalue[0] == ':') Perhaps there is no error here and the first part of the (categoryvalue[0] != '0') condition is simply redundant. But I suspect the error is real and the code should look like this: while (categoryvalue[0] != '0' && categoryvalue[0] != ':') Dereferencing a pointer before checking it This fragment is not necessarily unsafe - perhaps the pointer can never be null. But I should mention it anyway: static enum clnt_stat clntraw_call (h, proc, xargs, argsp, xresults, resultsp, timeout) CLIENT *h; u_long proc; xdrproc_t xargs; caddr_t argsp; xdrproc_t xresults; caddr_t resultsp;
  • 6. struct timeval timeout; { struct clntraw_private_s *clp = clntraw_private; XDR *xdrs = &clp->xdr_stream; .... if (clp == NULL) return RPC_FAILED; .... } V595 The 'clp' pointer was utilized before it was verified against nullptr. Check lines: 145, 150. clnt_raw.c 145 In the same file, not far from this piece, there is a similar defect: V595 The 'clp' pointer was utilized before it was verified against nullptr. Check lines: 232, 235. clnt_raw.c 232 Dangerous optimization (a vulnerability) char * __sha256_crypt_r (key, salt, buffer, buflen) const char *key; const char *salt; char *buffer; int buflen; { .... unsigned char temp_result[32] .... memset (temp_result, '0', sizeof (temp_result)); .... .... // temp_result not used further on } V597 The compiler could delete the 'memset' function call, which is used to flush 'temp_result' buffer. The RtlSecureZeroMemory() function should be used to erase the private data. sha256-crypt.c 385
  • 7. The compiler is allowed to remove the call of the memset() function when compiling the Release version. Well, it is actually obliged to do so for the sake of optimization. Since the 'temp_result' buffer is not used anywhere after calling the memset() function, the function call itself is not needed too. This is a vulnerability because the private data will not be erased. The memset() function should be replaced with a more appropriate one. The analyzer suggests RtlSecureZeroMemory(), which is absent in Linux of course. But there are other alternatives. The same defect: V597 The compiler could delete the 'memset' function call, which is used to flush 'temp_result' buffer. The RtlSecureZeroMemory() function should be used to erase the private data. sha512-crypt.c 396 Undefined behavior One might expect the glibc library's code to be written in such a way as to provide maximum portability. However, there are quite a lot of shift constructs in it, which can't be safe from the viewpoint of portability. This is what the C language standard has to say about shifts: The integer promotions are performed on each of the operands. The type of the result is that of the promoted left operand. If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined. The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with zeros. If E1 has an unsigned type, the value of the result is E1 * 2 pow E2, reduced modulo one more than the maximum value representable in the result type. If E1 has a signed type and nonnegative value, and E1 * 2 pow E2 is representable in the result type, then that is the resulting value; otherwise, the behavior is undefined. 5 The result of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type or if E1 has a signed type and a nonnegative value, the value of the result is the integral part of the quotient of E1 / 2 pow E2. If E1 has a signed type and a negative value, the resulting value is implementation-defined. It follows from this text that it is illegal to shift negative numbers. However, it is a very common operation in the glibc library. An example of left shift: static void init_cacheinfo (void) { .... count_mask = ~(-1 << (count_mask + 1)); .... } V610 Undefined behavior. Check the shift operator '<<. The left operand '-1' is negative. cacheinfo.c 645
  • 8. An example of right shift: utf8_encode (char *buf, int val) { .... *buf = (unsigned char) (~0xff >> step); .... } The "~0xff" expression is of the 'int' type and equals -256. Below is a list of all the code fragments with incorrect shift operations: • strxfrm_l.c 68 • clock_nanosleep.c 38 • ifaddrs.c 786 • xdr_intXX_t.c 35 • xdr_intXX_t.c 41 • private.h 327 • private.h 331 • zic.c 696 • zdump.c 212 • zdump.c 216 • timer_create.c 47 • timer_create.c 49 • loop.c 331 • loop.c 437 • mktime.c 207 • mktime.c 208 • mktime.c 211 • mktime.c 212 • mktime.c 230 • mktime.c 298 • mktime.c 298 • ld-collate.c 298 Using an uninitialized variable static int send_vc(....) { ....
  • 9. int truncating, connreset, resplen, n; .... #ifdef _STRING_ARCH_unaligned *anssizp2 = orig_anssizp - resplen; *ansp2 = *ansp + resplen; #else .... } V614 Uninitialized variable 'resplen' used. res_send.c 790 Incorrect string formatting In some fragments, '%u' is used to print signed variables, and in some other fragments, '%d' is used to print unsigned variables. These are trifles, of course, but they are worth mentioning. For example: typedef unsigned int __uid_t; typedef __uid_t uid_t; int user2netname (...., const uid_t uid, ....) { .... sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom); .... } V576 Incorrect format. Consider checking the fourth actual argument of the 'sprintf' function. The SIGNED integer type argument is expected. netname.c 51 Other defects of this kind: • Consider checking the second actual argument of the 'printf' function. The SIGNED integer type argument is expected. locarchive.c 1741 • Consider checking the fourth actual argument of the 'printf' function. The SIGNED integer type argument is expected. locarchive.c 1741
  • 10. • Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected. res_debug.c 236 • Consider checking the third actual argument of the 'sprintf' function. The UNSIGNED integer type argument is expected. inet_net_ntop.c 134 • Consider checking the fourth actual argument of the 'sprintf' function. The SIGNED integer type argument is expected. ns_print.c 500 • Consider checking the fifth actual argument of the 'sprintf' function. The SIGNED integer type argument is expected. ns_print.c 500 • Consider checking the third actual argument of the 'sprintf' function. The SIGNED integer type argument is expected. ns_print.c 572 • Consider checking the fourth actual argument of the 'sprintf' function. The SIGNED integer type argument is expected. ns_print.c 572 • Consider checking the fifth actual argument of the 'sprintf' function. The SIGNED integer type argument is expected. ns_print.c 572 • Consider checking the third actual argument of the 'sprintf' function. The UNSIGNED integer type argument is expected. ns_print.c 628 • Consider checking the fourth actual argument of the 'sprintf' function. The UNSIGNED integer type argument is expected. ns_print.c 628 • Consider checking the fifth actual argument of the 'sprintf' function. The UNSIGNED integer type argument is expected. ns_print.c 628 • Consider checking the third actual argument of the 'sprintf' function. The SIGNED integer type argument is expected. ns_print.c 645 • Consider checking the third actual argument of the 'sprintf' function. The UNSIGNED integer type argument is expected. ns_print.c 685 • Consider checking the second actual argument of the 'printf' function. The SIGNED integer type argument is expected. nis_print.c 209 • Consider checking the second actual argument of the 'printf' function. The SIGNED integer type argument is expected. sprof.c 480 Conclusion We should admit that we made a wrong choice for the experiment with testing our analyzer on code from the Linux world - the glibc project is just too high-quality. :) There are too few worthy defects to make the article interesting. But anyway, there are many other well-known and interesting projects under Linux waiting to be tested by PVS-Studio to demonstrate its capabilities. References 1. Andrey Karpov. Static analysis and regular expressions. 2. Dmitry Tkachenko. PVS-Studio and CppCat: An Interview with Andrey Karpov, the Project CTO and Developer.