scispace - formally typeset
Search or ask a question
Journal ArticleDOI

Using Static Analysis to Find Bugs

01 Sep 2008-IEEE Software (IEEE)-Vol. 25, Iss: 5, pp 22-29
TL;DR: FindBugs evaluates what kinds of defects can be effectively detected with relatively simple techniques and helps developers understand how to incorporate such tools into software development.
Abstract: Static analysis examines code in the absence of input data and without running the code. It can detect potential security violations (SQL injection), runtime errors (dereferencing a null pointer) and logical inconsistencies (a conditional test that can't possibly be true). Although a rich body of literature exists on algorithms and analytical frameworks used by such tools, reports describing experiences in industry are much harder to come by. The authors describe FindBugs, an open source static-analysis tool for Java, and experiences using it in production settings. FindBugs evaluates what kinds of defects can be effectively detected with relatively simple techniques and helps developers understand how to incorporate such tools into software development.

Summary (2 min read)

Using Static Analysis

  • Rather than trying to prove that the code fulfills its specification, such tools look for violations of reasonable or recommended programming practice.
  • A vibrant commercial industry has developed around advanced (and expensive) static-analysis tools,2,3 and several companies have their own proprietary in-house tools, such as Microsoft’s PREfix.
  • FindBugs has grown, paying careful attention to mistakes that occur in practice and to the techniques and features needed to effectively incorporate it into production software development.

FindBugs in practice

  • In its current form, FindBugs recognizes more than 300 programming mistakes and dubious coding idioms that it can identify using simple analysis techniques.
  • FindBugs also uses more sophisticated analysis techniques, devised to help effectively identify certain issues—such as dereferencing of null pointers—that occur frequently enough to warrant their development.
  • Unlike some other tools designed to provide security guarantees, FindBugs doesn’t try to identify all defects in a particular category or prove that software doesn’t contain a particular defect.
  • Rather, it’s designed to effectively identify lowhanging fruit—to cheaply detect defects the authors believe developers will want to review and remedy.
  • Many developers use FindBugs ad hoc, and a growing number of projects and companies are integrating it into their standard build and testing systems.

Defects in real code

  • To appreciate static analysis for defect detection in general, and FindBugs in particular, it helps to be familiar with some sample defects found in real code.
  • In some cases, the conditions might be closely related and some simple theorem proving can show whether the path is feasible or infeasible.

FindBugs nuts and bolts

  • FindBugs has a plug-in architecture in which detectors can be defined, each of which might report several different bug patterns.
  • Detectors can access information about types, constant values, and special flags, as well as values stored on the stack or in local variables.
  • FindBugs groups each bug pattern into a category (such as correctness, bad practice, performance, and internationalization) and assigns each bug pattern report either high, medium, or low priority.
  • Because the char type in Java is unsigned, this check will never be true.

Experiences at Google

  • Google’s use of FindBugs has evolved over the past two years in three distinct phases.
  • Successfully injecting FindBugs into Google’s development process required more than just making all warnings available outside an engineer’s normal workflow.
  • As the authors gained experience and developer feedback, they prioritized their evaluation on the basis of their prior empirical results.
  • Engineers discuss the code using these comments and note completed modifications.
  • The authors rank- ing and false-positive suppression mechanisms are crucial to keeping the displayed warnings relevant and valuable so that users don’t start ignoring the more recent, important warnings along with the older, more trivial ones.

Survey of findBugs users

  • Many organizations place the responsibility for deciding whether a warning is a bug into a single individual’s hands.
  • Through user surveys, the authors found that actual FindBugs use is more diverse than we’d expected and that many things they believe to be best practices have yet to be widely adopted.
  • We’re continuing studies with users and development organizations because it seems clear to us that development, measurement, validation, and adoption of best practices for static-analysis tools is key to enabling their effective use.

Did you find this useful? Give us your feedback

Content maybe subject to copyright    Report

focus
22 I E E E S O F T W A R E P u b l i s h e d b y t h e I E E E C o m p u t e r S o c i e t y 0 7 4 0 -7 4 5 9 / 0 8 / $ 2 5 . 0 0 © 2 0 0 8 I E E E
software development tools
Using Static Analysis
to Find Bugs
Nathaniel Ayewah and William Pugh, University of Maryland
David Hovemeyer, York College of Pennsylvania
J. David Morgenthaler and John Penix, Google
FindBugs, an open
source static-analysis
tool for Java,
evaluates what kinds
of defects can be
effectively detected
with relatively
simple techniques.
S
oftware quality is important, but often imperfect in practice. We can use many
techniques to try to improve quality, including testing, code review, and for-
mal specification. Static-analysis tools evaluate software in the abstract, with-
out running the software or considering a specific input. Rather than trying
to prove that the code fulfills its specification, such tools look for violations of reason-
able or recommended programming practice. Thus, they look for places in which code
might dereference a null pointer or overflow an array. Static-analysis tools might also
flag an issue such as a comparison that cant pos-
sibly be true. Although the comparison wont cause
a failure or exception, its existence suggests that it
might have resulted from a coding error, leading to
incorrect program behavior.
Some tools also flag or enforce programming
style issues, such as naming conventions or the use
of curly braces in conditionals and looping struc-
tures. The lint program for C programs
1
is gener-
ally considered the first widely used static-analysis
tool for defect detection, although by today’s stan-
dards it’s rather limited. Researchers have done
significant work in the area over the past decade,
driven substantially by concerns over defects that
lead to security vulnerabilities, such as buffer over-
flows, format string vulnerabilities, SQL injection,
and cross-site scripting. A vibrant commercial in-
dustry has developed around advanced (and expen-
sive) static-analysis tools,
2,3
and several companies
have their own proprietary in-house tools, such as
Microsoft’s PREfix.
4
Many commercial tools are
sophisticated, using deep analysis techniques. Some
can use or depend on annotations that describe in-
variants and other intended software properties
that tools cant easily infer, such as the intended re-
lationship between function parameters.
FindBugs is an example of a static-analysis tool
that looks for coding defects.
5–7
The FindBugs
project began as an observation, developed into an
experiment, and snowballed into a widely used tool
with more than half a million downloads world-
wide. The observation that started it all was that
some Java programs contained blatant mistakes
that were detectable with fairly trivial analysis
techniques. Initial experiments showed that even
production qualitysoftware contained such mis-
takes and that even experienced developers made
them. FindBugs has grown, paying careful atten-
tion to mistakes that occur in practice and to the
techniques and features needed to effectively incor-
porate it into production software development.
Here, we review the types of issues FindBugs
identifies, discuss the techniques it uses, and look
at some experiences using FindBugs on Suns Java
Development Kit (JDK) and Googles Java code
base.
Authorized licensed use limited to: University of Maryland College Park. Downloaded on January 15, 2010 at 13:21 from IEEE Xplore. Restrictions apply.

September/October 2008 I E E E S O F T W A R E
23
FindBugs in practice
In its current form, FindBugs recognizes more than
300 programming mistakes and dubious coding id-
ioms that it can identify using simple analysis tech-
niques. FindBugs also uses more sophisticated anal-
ysis techniques, devised to help effectively identify
certain issues—such as dereferencing of null point-
ers—that occur frequently enough to warrant their
development. Unlike some other tools designed to
provide security guarantees, FindBugs doesnt try
to identify all defects in a particular category or
prove that software doesnt contain a particular de-
fect. Rather, it’s designed to effectively identify low-
hanging fruit—to cheaply detect defects we believe
developers will want to review and remedy.
Many developers use FindBugs ad hoc, and a
growing number of projects and companies are
integrating it into their standard build and testing
systems. Google has incorporated FindBugs into its
standard testing and code-review process and has
fixed more than 1,000 issues in its internal code
base that FindBugs has identified.
Defects in real code
To appreciate static analysis for defect detection
in general, and FindBugs in particular, it helps to
be familiar with some sample defects found in real
code. Let’s look at some examples from Suns JDK
1.6.0 implementation, which also are representative
of code seen elsewhere.
One unexpectedly common defect is the infi-
nite recursive loop—that is, a function that always
returns the result of invoking itself. We originally
extended FindBugs to look for this defect because
some freshman at the University of Maryland
had trouble understanding how Java constructors
worked. When we ran it against build 13 of Suns
JDK 1.6, we found five infinite recursive loops,
including
public String foundType() {
return this.foundType();
}
This code should have been a getter method for
the field foundType, but the extra parenthesis means
it always recursively calls itself until the stack over-
flows. Various mistakes lead to infinite recursive
loops, but the same simple techniques can detect
them all. Google has found and fixed more than 70
infinite recursive loops in their code base, and they
occur surprisingly frequently in other code bases
we’ve examined.
Another common bug pattern is when software
invokes a method but ignores its return value, de-
spite the fact that doing so makes no sense. An ex-
ample is the statement s.toLowerCase(), where s is a String.
Because Strings in Java are immutable, the toLowerCase()
method has no effect on the String its invoked on,
but rather returns a new String. The developer prob-
ably intended to write s = s.toLowerCase(). Another ex-
ample is when a developer creates an exception but
forgets to throw it:
try { ... }
catch (IOException e) {
new SAXException(....);
}
FindBugs uses an intraprocedural dataflow anal-
ysis to identify places in which the code could deref-
erence a null pointer.
5,7
Although developers might
need to examine dozens of lines to understand some
defects reported by FindBugs, most can be under-
stood by examining only a few lines of code. One
common case is using the wrong relational or Bool-
ean operation, as in a test to see whether (name != null
|| name.length > 0). Java evaluates the && and || opera-
tors using short-circuit evaluation: the right-hand
side is evaluated only if needed in order to determine
the expressions value. In this case, Java will evalu-
ate the expression name.length only when name is null,
leading to a null pointer exception. The code would
be correct if it had used && rather than ||. FindBugs
also identifies situations in which the code checks
a value for null in some places and unconditionally
dereferences it in others. The following code, for ex-
ample, checks the variable g to see if its null, but if
it is null, the next statement will always deference it,
resulting in a null pointer exception:
if (g != null)
paintScrollBars(g,colors);
g.dispose();
FindBugs also performs an intraprocedural type
analysis that takes into account information from
instanceof tests and finds errors such as checked casts
that always throw a class cast exception. It also
finds places in which two objects guaranteed to be
of unrelated types are compared for equality (for
example, where a StringBuffer is compared to a String,
or the bug Figure 1 shows).
Many other bug patterns exist, some covering
obscure aspects of the Java APIs and languages. A
particular pattern might find only one issue in sev-
eral million lines of code, but collectively these find
a significant number of issues. Examples include
checking whether a double value is equal to Double.
NaN (nothing is equal to Double.NaN, not even Double.NaN)
FindBugs
doesn’t try
to identify
all defects
in a particular
category.
Authorized licensed use limited to: University of Maryland College Park. Downloaded on January 15, 2010 at 13:21 from IEEE Xplore. Restrictions apply.

24 I E E E S O F T W A R E w w w . c o m p u t e r. o r g / s o f t w a r e
or performing a bit shift of a 32-bit int value by a
constant value greater than 31.
What FindBugs doesn’t find
FindBugs doesn’t look for or report numerous po-
tential defects that more powerful tools report.
24
We designed it this way for two reasons: to keep
the analysis relatively simple and to avoid generat-
ing too many warnings that dont correspond to
true defects.
One such case is finding null pointer dereferences
that occur only if a particular path through the pro-
gram is executed. Reasoning reported such an issue
in Apache Tomcat 4.1.24.
8
Reasoning warns that if
the body of the first if statement isnt executed but
the body of the second if statement is executed, then
a null pointer exception will occur:
HttpServletResponse hres = null;
if (sres instanceof HttpServletResponse)
hres = (HttpServletResponse) sres;
// Check to see if available
if (!(...).getAvailable()) {
hres.sendError(...)
The problem is that the analysis doesnt know
whether that path is feasible. Perhaps the condition
in the second statement can be true only if the con-
dition in the first statement is true. In some cases,
the conditions might be closely related and some
simple theorem proving can show whether the path
is feasible or infeasible. But showing that a particu-
lar path is feasible can be much harder, and is in
general undecidable.
Rather than worry about whether particular
paths are feasible, FindBugs looks for branches or
statements that, if executed, guarantee that a null
pointer exception will occur. We’ve found that al-
most all null pointer issues we report are either real
bugs or inconsistent code with branches or state-
ments that cant be executed. Code that is merely
inconsistent might not be changed if it’s already
used in production, but generally would be con-
sidered unacceptable in new code if found during
code review.
We also havent pursued checks for array indi-
ces that are out of bounds. Detecting such errors re-
quires tracking relations between various variables
(for instance, is i less than the length of a), and can
become arbitrarily complicated. Some simple tech-
niques might accurately report some obvious bugs,
but we havent yet investigated this.
FindBugs nuts and bolts
FindBugs has a plug-in architecture in which de-
tectors can be defined, each of which might report
several different bug patterns. Rather than use a
pattern language to describe bugs (as PMD
9
and
Metal
10
do), FindBugs detectors are simply writ-
ten in Java using various techniques. Many simple
detectors use a visitor pattern over the class files
or method byte codes. Detectors can access infor-
mation about types, constant values, and special
flags, as well as values stored on the stack or in local
variables.
Detectors can also traverse the control-flow
graph, using the results of data-flow analysis such as
type information, constant values, and nullness. The
data-flow algorithms all generally use information
from conditional tests, so that the analysis results in-
corporate information from instanceof and null tests.
FindBugs doesnt perform interprocedural con-
text-sensitive analysis. However, many detectors
use global information, such as subtype relation-
ships and fields accessed across the entire applica-
tion. A few detectors use interprocedural summary
information, such as which method parameters are
always dereferenced.
FindBugs groups each bug pattern into a cat-
egory (such as correctness, bad practice, perfor-
mance, and internationalization) and assigns each
bug pattern report either high, medium, or low
priority. FindBugs determines priorities via heuris-
tics unique to each detector or pattern that arent
necessarily comparable across bug patterns. In nor-
mal operation, FindBugs doesnt report low-priority
warnings.
The most important aspect of the FindBugs
project is perhaps how we develop new bug detec-
tors: we start with real bugs and develop the sim-
plest possible technique that effectively finds such
bugs. This approach often lets us go from finding a
particular instance of a bug to implementing a de-
Figure 1. The FindBugs
Swing GUI. The
interface shows
FindBugs reviewing
a bug in Suns Java
Development Kit.
Authorized licensed use limited to: University of Maryland College Park. Downloaded on January 15, 2010 at 13:21 from IEEE Xplore. Restrictions apply.

September/October 2008 I E E E S O F T W A R E
25
tector that can effectively find instances of it within
hours. Many bugs are quite simple—one bug pat-
tern most recently added to FindBugs occurs when
the code casts an int value to a char and checks the
result to see whether it’s 1. Because the char type
in Java is unsigned, this check will never be true.
A post on http://worsethanfailure.com inspired this
bug detector, and within less than an hour, we had
implemented a detector that found 11 such errors in
Eclipse 3.3M6.
We can run FindBugs from the command line,
using Ant or Maven, within Eclipse or NetBeans,
or in a stand-alone GUI (see Figure 1). We can save
the analysis results in XML, which we can then
further filter, transform, or import into a database.
FindBugs supports two mechanisms that let users
and tools identify corresponding warnings from dif-
ferent analysis runs, even if line numbers and other
program artifacts have changed.
6
This lets tools de-
termine which issues are new and track audits and
human reviews.
FindBugs experiences
We’ve evaluated the issues FindBugs uncovered in
Suns JDK 1.6.0 implementation elsewhere.
11
To
briefly summarize, we looked at each FindBugs
medium- or high-priority correctness warning that
was in one build and not reported in the next,
even though the class containing the warning was
still present. Out of 53 such warning removals, 37
were due to a small targeted program change that
seemed to narrowly focus on remedying the issue
the warning described. Five were program changes
that changed the code such that FindBugs no longer
reported the issue, even though the change didnt
completely address aspects of the underlying issue.
The remaining 11 warnings disappeared owing to
substantial changes or refactorings that had a larger
scope than just removing the one defect.
In previous research, we also manually evalu-
ated all the medium- and high-priority correctness
warnings in build 105 (the official release of Java
1.6.0). We classified the 379 medium- and high-
priority correctness warnings as follows:
5 occurred owing to bad analysis on FindBugs
part (in one case, it didnt understand that a
method call could change a field);
160 were in unreachable code or likely to have
little or no functional impact;
176 seemed to have functional impact; and
38 seemed to have substantial functional im-
pact—that is, the method containing the warn-
ing would clearly behave in a way substantially
at odds with its intended function.
A detailed breakdown of the defect classification
associated with each bug pattern appears in our
previous paper.
11
Clearly, any such classification is
open to interpretation, and other reviewers would
likely produce slightly different classifications. Also,
our assessment of functional impact might differ
from the actual end-user perspective. For example,
even if a method is clearly broken, it might never
be called or be invokable by user code. However,
given many bug patterns localized nature, we
have some confidence in our classifications’ general
soundness.
Experiences at Google
Googles use of FindBugs has evolved over the past
two years in three distinct phases. We used the les-
sons learned during each phase to plan and develop
the next one.
The first phase involved automating FindBugs
to run over all newly checked-in Java source code
and store any generated warnings. A simple Web
interface let developers check projects for possible
bugs and mark false positives. Our initial database
couldnt track warnings over different versions, so
the Web interface saw little use. Developers couldnt
determine which warnings applied to which file ver-
sions or whether the warnings were fresh or stale.
When a defect was fixed, this event wasnt reported
by our process. Such stale warnings have a greater
negative impact on the developers user experience
than a false positive. Successfully injecting Find-
Bugs into Googles development process required
more than just making all warnings available out-
side an engineer’s normal workflow.
In our project’s second phase, we implemented
a service model in which two of the authors (Da-
vid Morgenthaler and John Penix) spent half the
time evaluating warnings and reporting those we
decided were significant defects in Google’s bug-
tracking systems. Over the next six months, we
evaluated several thousand FindBugs warnings
and filed more than 1,000 bug reports. At first,
this effort focused on bug patterns we chose on
the basis of our own opinions about their impor-
tance. As we gained experience and developer
feedback, we prioritized our evaluation on the ba-
sis of our prior empirical results. We ranked the
different patterns using both the observed false-
positive rate and the observed fix rate for issues
we filed as bugs. Thus, we spent more time evalu-
ating warnings that developers were more likely
to x. This ranking scheme carried over into the
third phase, as we noticed that our service model
wouldnt scale well as Google grew.
We observed that, in many cases, filing a bug
Stale
warnings
have a greater
negative
impact on the
developer’s
user
experience
than a false
positive.
Authorized licensed use limited to: University of Maryland College Park. Downloaded on January 15, 2010 at 13:21 from IEEE Xplore. Restrictions apply.

26 I E E E S O F T W A R E w w w . c o m p u t e r. o r g / s o f t w a r e
report was more effort than simply fixing the code.
To better scale the operation, we needed to move
the analysis feedback closer to the development
workflow. In the third and current phase, we ex-
ploit Google’s code-review policy and tools. Be-
fore a developer checks code changes into Googles
source-control system, another developer must first
review them. Different tools help support this pro-
cess, including Mondrian, a sophisticated, internal
Web-based review tool.
12
Mondrian lets reviewers add inline comments
to code that are visible to other Mondrian users,
including the original requester. Engineers discuss
the code using these comments and note completed
modifications. For example, a reviewer might re-
quest in an inline comment, “Please rename this
variable.In response, the developer would make
the requested change and reply to the original com-
ment with an inline “Done.” We let Mondrian us-
ers see FindBugs, and other static-analysis warn-
ings, as inline comments from our automated
reviewer, BugBot. We provide a false-positive sup-
pression mechanism and let developers filter the
comments displayed by confidence from high-
est to lowest. Users select the minimum confidence
level they wish to see, which suppresses all lower-
ranked warnings.
This system scales quite well, and weve seen
more than 200 users verify or suppress thousands
of warnings in the past six months. We must still
make some improvements, such as automatically
running FindBugs on each development version
of a file while developers are reviewing it and be-
fore they check it in. The main lesson we learned
from this experience is that developers will pay
attention to, and x, FindBugs warnings if they
appear seamlessly within the workflow. It helps
that code reviewers can also see the warnings and
request fixes as they review the code. Our rank-
ing and false-positive suppression mechanisms are
crucial to keeping the displayed warnings relevant
and valuable so that users dont start ignoring the
more recent, important warnings along with the
older, more trivial ones.
Survey of FindBugs users
Many studies on static-analysis tools focus on their
correctness (are the warnings they identify real
problems?), their completeness (do they find all
problems in a given category?), or their performance
in terms of memory and speed. As organizations
begin integrating these tools into their software
processes, we must consider other aspects of the
interactions between these tools and users or pro-
cesses. Do these tools slow down the process with
unnecessary warnings, or is the value they provide
(in terms of problems found) worth the investment
in time? What’s the best way to integrate these tools
into a given process? Should all developers interact
with the tools, or should quality assurance special-
ists winnow out less useful warnings?
Few rules of thumb exist about the best ways
to use static-analysis tools. Rather different soft-
ware teams use a hodgepodge of methods. Many
users don’t even have a formal process for finding
defects using tools—they run the tools only occa-
sionally and aren’t consistent in how they respond
to warnings. In the end, users might not derive full
value from static-analysis tools, and some might
discontinue their use, incorrectly perceiving that
they lack value.
The FindBugs team has started a project that
aims to identify and evaluate tool features, validate
or invalidate assumptions tool vendors hold, and
guide individuals and teams wanting to use static-
analysis tools effectively. At this early stage, it isnt
clear what the problems are and what questions we
should investigate in more depth. So, we’re con-
ducting some surveys and interviews to get qualita-
tive feedback from FindBugs users. We want to de-
termine who our users are, how they use FindBugs,
how they integrate it into their processes, and what
their perception of its effectiveness is. Beyond sur-
veys and interviews, we hope to spend time observ-
ing users in their work environments to capture the
nuances in their interactions with this tool.
The following sections detail some observations
from the surveys and interviews.
On FindBugs’ utility and impact. The central challenge
for tool creators is to identify warnings that users
are concerned with. Tools such as FindBugs assess
each warning on the basis of its severity (how serious
the problem is in general) and the tools confidence
Table 1
Users that review at least high-priority warnings
for each category (out of 252)
Bug category reviewed Percentage of users
Bad practice 96
Performance 96
Correctness 95
Multithreaded correctness 93
Malicious code vulnerability 86
Dodgy 86
Internationalization 57
Authorized licensed use limited to: University of Maryland College Park. Downloaded on January 15, 2010 at 13:21 from IEEE Xplore. Restrictions apply.

Citations
More filters
Proceedings ArticleDOI
18 May 2013
TL;DR: Why developers are not widely using static analysis tools and how current tools could potentially be improved are investigated and several implications are discussed, such as the need for an interactive mechanism to help developers fix defects.
Abstract: Using static analysis tools for automating code inspections can be beneficial for software engineers. Such tools can make finding bugs, or software defects, faster and cheaper than manual inspections. Despite the benefits of using static analysis tools to find bugs, research suggests that these tools are underused. In this paper, we investigate why developers are not widely using static analysis tools and how current tools could potentially be improved. We conducted interviews with 20 developers and found that although all of our participants felt that use is beneficial, false positives and the way in which the warnings are presented, among other things, are barriers to use. We discuss several implications of these results, such as the need for an interactive mechanism to help developers fix defects.

488 citations


Cites background from "Using Static Analysis to Find Bugs"

  • ...She wants to make sure that she is following the company’s standards while maintaining quality code....

    [...]

  • ...There are a variety of ways to perform automatic static analyses [3], including at the developers request, continuously while creating the software in a development environment, and just before the software is committed to a version control system....

    [...]

  • ...There have been many studies on static analysis tools, many of which focus on their correctness and functionality [6], [10], [14], [15]....

    [...]

Journal ArticleDOI
TL;DR: An extensive review of the many different works in the field of software vulnerability analysis and discovery that utilize machine-learning and data-mining techniques that utilize both advantages and shortcomings in this domain is provided.
Abstract: Software security vulnerabilities are one of the critical issues in the realm of computer security. Due to their potential high severity impacts, many different approaches have been proposed in the past decades to mitigate the damages of software vulnerabilities. Machine-learning and data-mining techniques are also among the many approaches to address this issue. In this article, we provide an extensive review of the many different works in the field of software vulnerability analysis and discovery that utilize machine-learning and data-mining techniques. We review different categories of works in this domain, discuss both advantages and shortcomings, and point out challenges and some uncharted territories in the field.

254 citations


Cites background from "Using Static Analysis to Find Bugs"

  • ...…is a static program analysis approach where untrusted data from input sources is marked as tainted and its flow to sensitive program statements known as sinks is tracked as a potential indicator of vulnerability (Evans and Larochelle 2002; Larus et al. 2004; Ayewah et al. 2008; Bessey et al. 2010)....

    [...]

BookDOI
01 Jan 2016
TL;DR: This book is the definitive guide to KeY that lets you explore the full potential of deductive software verification in practice and contains the complete theory behind KeY for active researchers who want to understand it in depth or use it in their own work.
Abstract: Static analysis of software with deductive methods is a highly dynamic field of research on the verge of becoming a mainstream technology in software engineering. It consists of a large portfolio of - mostly fully automated - analyses: formal verification, test generation, security analysis, visualization, and debugging. All of them are realized in the state-of-art deductive verification framework KeY. This book is the definitive guide to KeY that lets you explore the full potential of deductive software verification in practice. It contains the complete theory behind KeY for active researchers who want to understand it in depth or use it in their own work. But the book also features fully self-contained chapters on the Java Modeling Language and on Using KeY that require nothing else than familiarity with Java. All other chapters are accessible for graduate students (M.Sc. level and beyond). The KeY framework is free and open software, downloadable from the book companion website which contains also all code examples mentioned in this book.

241 citations

Journal ArticleDOI
TL;DR: In this article, the authors provide an interdisciplinary survey on challenges and state-of-the-art in evolution of automated production systems, and summarize future research directions to address the challenges of evolution in automated production system.

213 citations

Journal ArticleDOI
TL;DR: It is shown that adopting OSS involves more than simply using OSS products, and a framework consisting of six distinctly different ways in which organizations adopt OSS is provided, used to illustrate some of the opportunities and challenges organizations meet when approaching OSS.
Abstract: Context: Open source software (OSS) is changing the way organizations develop, acquire, use, and commercialize software. Objective: This paper seeks to identify how organizations adopt OSS, classify the literature according to these ways of adopting OSS, and with a focus on software development evaluate the research on adoption of OSS in organizations. Method: Based on the systematic literature review method we reviewed publications from 24 journals and seven conference and workshop proceedings, published between 1998 and 2008. From a population of 24,289 papers, we identified 112 papers that provide empirical evidence on how organizations actually adopt OSS. Results: We show that adopting OSS involves more than simply using OSS products. We moreover provide a classification framework consisting of six distinctly different ways in which organizations adopt OSS. This framework is used to illustrate some of the opportunities and challenges organizations meet when approaching OSS, to show that OSS can be adopted successfully in different ways, and to organize and review existing research. We find that existing research on OSS adoption does not sufficiently describe the context of the organizations studied, and it fails to benefit fully from related research fields. While existing research covers a large number of topics, it contains very few closely related studies. To aid this situation, we offer directions for future research. Conclusion: The implications of our findings are twofold. On the one hand, practitioners should embrace the many opportunities OSS offers, but consciously evaluate the consequences of adopting it in their own context. They may use our framework and the success stories provided by the literature in their own evaluations. On the other hand, researchers should align their work, and perform more empirical research on topics that are important to organizations. Our framework may be used to position this research and to describe the context of the organization they are studying.

201 citations


Additional excerpts

  • ...Public [24,57,63,81] [13,182] [10,15,54,152,182] [11,15] [22,23,47,104,108,156] [182]...

    [...]

References
More filters
Journal ArticleDOI
TL;DR: A compile‐time analyzer that detects these dynamic errors in large, real‐world programs, and provides valuable contextual information to the programmer who needs to understand and repair the defects.
Abstract: There are important classes of programming errors that are hard to diagnose, both manually and automatically, because they involve a program's dynamic behavior. This article describes a compile-time analyzer that detects these dynamic errors in large, real-world programs. The analyzer traces execution paths through the source code, modeling memory and reporting inconsistencies. In addition to avoiding false paths through the program, this approach provides valuable contextual information to the programmer who needs to understand and repair the defects. Automatically-created models, abstracting the behavior of individual functions, allow inter-procedural defects to be detected efficiently. A product built on these techniques has been used effectively on several large commercial programs. Copyright © 2000 John Wiley & Sons, Ltd.

542 citations

Proceedings ArticleDOI
13 Jun 2007
TL;DR: FindBugs, a static analysis tool that finds defects in Java programs, is discussed and the kinds of warnings generated and the classification of warnings into false positives, trivial bugs and serious bugs are discussed.
Abstract: Static analysis tools for software defect detection are becoming widely used in practice. However, there is little public information regarding the experimental evaluation of the accuracy and value of the warnings these tools report. In this paper, we discuss the warnings found by FindBugs, a static analysis tool that finds defects in Java programs. We discuss the kinds of warnings generated and the classification of warnings into false positives, trivial bugs and serious bugs. We also provide some insight into why static analysis tools often detect true but trivial bugs, and some information about defect warnings across the development lifetime of software release. We report data on the defect warnings in Sun's Java 6 JRE, in Sun's Glassfish JEE server, and in portions of Google's Java codebase. Finally, we report on some experiences from incorporating static analysis into the software development process at Google.

230 citations

Book
14 Jun 2007
TL;DR: The first expert guide to static analysis for software security is as discussed by the authors, which provides a complete guide to how to integrate static analysis into the software development process and how to make the most of it during security code review.
Abstract: The First Expert Guide to Static Analysis for Software Security!Creating secure code requires more than just good intentions. Programmers need to know that their code will be safe in an almost infinite number of scenarios and configurations. Static source code analysis gives users the ability to review their work with a fine-toothed comb and uncover the kinds of errors that lead directly to security vulnerabilities. Now, there's a complete guide to static analysis: how it works, how to integrate it into the software development processes, and how to make the most of it during security code review. Static analysis experts Brian Chess and Jacob West look at the most common types of security defects that occur today. They illustrate main points using Java and C code examples taken from real-world security incidents, showing how coding errors are exploited, how they could have been prevented, and how static analysis can rapidly uncover similar mistakes. This book is for everyone concerned with building more secure software: developers, security engineers, analysts, and testers.Coverage includes:? Why conventional bug-catching often misses security problems? How static analysis can help programmers get security right? The critical attributes and algorithms that make or break a static analysis tool? 36 techniques for making static analysis more effective on your code? More than 70 types of serious security vulnerabilities, with specific solutions? Example vulnerabilities from Firefox, OpenSSH, MySpace, eTrade, Apache httpd, and many more? Techniques for handling untrusted input? Eliminating buffer overflows: tactical and strategic approaches? Avoiding errors specific to Web applications, Web services, and Ajax? Security-aware logging, debugging, and error/exception handling? Creating, maintaining, and sharing secrets and confidential information? Detailed tutorials that walk you through the static analysis process“We designed Java so that it could be analyzed statically. This book shows you how to apply advanced static analysis techniques to create more secure, more reliable software.”i??Bill Joy, Co-founder of Sun Microsystems, co-inventor of the Java programming language“'Secure Programming with Static Analysis' is a great primer on static analysis for security-minded developers and security practitioners. Well-written, easy to read, tells you what you need to know.”i??David Wagner, Associate Professor, University of California Berkeley“Software developers are the first and best line of defense for the security of their code. This book gives them the security development knowledge and the tools they need in order to eliminate vulnerabilities before they move into the final products that can be exploited.”i??Howard A. Schmidt, Former White House Cyber Security AdvisorBRIAN CHESS is Founder and Chief Scientist of Fortify Software, where his research focuses on practical methods for creating secure systems. He holds a Ph.D. in Computer Engineering from University of California Santa Cruz, where he studied the application of static analysis to finding security-related code defects.JACOB WEST manages Fortify Software's Security Research Group, which is responsible for building security knowledge into Fortify's products. He brings expertise in numerous programming languages, frameworks, and styles together with deep knowledge about how real-world systems fail.CD contains a working demonstration version of Fortify Software's Source Code Analysis (SCA) product; extensive Java and C code samples; and the tutorial chapters from the book in PDF format.Part I: Software Security and Static Analysisi? i? i? i? i? i? i? 1 1i? i? i? i? i? i? i? i? i? The Software Security Problemi? i? i? i? i? i? i? i? i? 3 2i? i? i? i? i? i? i? i? i? Introduction to Static Analysis 21 3i? i? i? i? i? i? i? i? i? Static Analysis as Part of the Code Review Processi? i? i? 47 4i? i? i? i? i? i? i? i? i? Static Analysis Internalsi? i? i? i? i? i? i? i? i? 71Part II: Pervasive Problemsi? i? i? i? i? i? i? i? i? i? i? 115 5i? i? i? i? i? i? i? i? i? Handling Input 117 6i? i? i? i? i? i? i? i? i? Buffer Overflowi? i? i? i? i? i? i? i? i? i? 175 7i? i? i? i? i? i? i? i? i? Bride of Buffer Overflowi? i? i? i? i? i? i? i? 235 8i? i? i? i? i? i? i? i? i? Errors and Exceptionsi? 265Part III: Features and Flavorsi? i? i? i? i? i? i? i? 295 9i? i? i? i? i? i? i? i? i? Web Applicationsi? i? i? i? i? i? i? 297 10i? i? i? i? i? i? i? i? XML and Web Servicesi? i? i? i? i? i? i? i? i? i? 349 11i? i? i? i? i? i? i? i? Privacy and Secretsi? i? i? i? 379 12i? i? i? i? i? i? i? i? Privileged Programsi? i? i? 421Part IV: Static Analysis in Practicei? 457 13i? i? i? i? i? i? i? i? Source Code Analysis Exercises for Javai? i? i? i? i? i? i? 459 14i? i? i? i? i? i? i? i? Source Code Analysis Exercises for C 503 Epiloguei? i? i? i? i? i? i? i? i? 541Referencesi? i? i? i? i? 545Indexi? i? 559

226 citations

Proceedings ArticleDOI
13 Jun 2007
TL;DR: FindBugs now reports 4 of the 9 warnings in Tomcat, shows that one of the warnings reported by Reasoning is a false positive, and classifies the remaining 4 as being dependent on the feasibility of a particular path, which cannot be easier ascertained by a local examination of the source code.
Abstract: In the summer of 2006, the FindBugs project was challenged to improve the null pointer analysis in FindBugs so that we could find more null pointer bugs. In particular, we were challenged to try to do as well as a publicly available analysis by Reasoning, Inc on version 4.1.24 of Apache Tomcat. Reasoning's report is a result of running their own static analysis tool and using manual auditing to remove false positives. Reasoning reported a total of 9 null pointer warnings in Tomcat 4.1.24, of which only 2 were reported by FindBugs 1.0. While we wanted to improve the analysis in FindBugs, we wanted to retain our current low level of false positives.As of result of the work presented in this paper, FindBugs now reports 4 of the 9 warnings in Tomcat, shows that one of the warnings reported by Reasoning is a false positive, and classifies the remaining 4 as being dependent on the feasibility of a particular path, which cannot be easier ascertained by a local examination of the source code. Moreover, we found 24 additional null pointer bugs in Tomcat that had been missed by Reasoning, and overall doubled the number of null pointer bugs found by FindBugs while improving the quality and significance of reported defects.

123 citations

Journal ArticleDOI
05 Sep 2005
TL;DR: It is shown that simple analysis techniques can be used to identify many software defects, both in production code and in student code, and are able to pinpoint 50% to 80% of the defects leading to a null pointer exception at runtime.
Abstract: Using static analysis to detect memory access errors, such as null pointer dereferences, is not a new problem. However, much of the previous work has used rather sophisticated analysis techniques in order to detect such errors.In this paper we show that simple analysis techniques can be used to identify many such software defects, both in production code and in student code. In order to make our analysis both simple and effective, we use a non-standard analysis which is neither complete nor sound. However, we find that it is effective at finding an interesting class of software defects.We describe the basic analysis we perform, as well as the additional errors we can detect using techniques such as annotations and inter-procedural analysis.In studies of both production software and student projects, we find false positive rates of around 20% or less. In the student code base, we find that our static analysis techniques are able to pinpoint 50% to 80% of the defects leading to a null pointer exception at runtime.

106 citations

Frequently Asked Questions (9)
Q1. What have the authors contributed in "Using static analysis to find bugs" ?

The authors can use many techniques to try to improve quality, including testing, code review, and formal specification. 

Java evaluates the && and || operators using short-circuit evaluation: the right-hand side is evaluated only if needed in order to determine the expression’s value. 

(Eleven percent of users said a team does the review, and 14 percent indicated that a reviewer can make independent decisions only for trivial cases.) 

Other policies include automatically inserting warnings into a bug tracker, having one or two people who maintain FindBugs and review warnings, requiring that warnings are human reviewed within a given time limit or warning-count threshold, integrating FindBugs into code review, running FindBugs automatically overnight and emailing problems to developers, and using a continuous-build server to display active warnings. 

The main lesson the authors learned from this experience is that developers will pay attention to, and fix, FindBugs warnings if they appear seamlessly within the workflow. 

In their project’s second phase, the authors implemented a service model in which two of the authors (David Morgenthaler and John Penix) spent half the time evaluating warnings and reporting those the authors decided were significant defects in Google’s bugtracking systems. 

This makes it likely that many reviews take place closer to the release date, when the pressure means that the emphasis is more on suppressing warnings than fixing code. 

Some users are wary of “tuning code” to FindBugs by modifying the code to remove even low-pri-ority warnings or adding annotations. 

}This code should have been a getter method for the field foundType, but the extra parenthesis means it always recursively calls itself until the stack overflows.