diff --git a/infer/tests/codetoanalyze/cpp/checkers/Makefile b/infer/tests/codetoanalyze/cpp/checkers/Makefile index aa6b8906a..b93268b9b 100644 --- a/infer/tests/codetoanalyze/cpp/checkers/Makefile +++ b/infer/tests/codetoanalyze/cpp/checkers/Makefile @@ -23,6 +23,7 @@ SOURCES = \ siof/siof_templated.cpp \ siof/siof_different_tu.cpp \ siof/std_ios_base_init.cpp \ + bufferoverrun/vector.cpp \ HEADERS = siof/siof_types.h diff --git a/infer/tests/codetoanalyze/cpp/checkers/bufferoverrun/vector.cpp b/infer/tests/codetoanalyze/cpp/checkers/bufferoverrun/vector.cpp new file mode 100644 index 000000000..535bb947e --- /dev/null +++ b/infer/tests/codetoanalyze/cpp/checkers/bufferoverrun/vector.cpp @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2017 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ +#include + +void FN_out_of_bound_Bad(std::vector v) { + unsigned int n = v.size(); + v[n] = 1; +}