From 9bb5738675a8ece0955faf5799d6fd1524b606a8 Mon Sep 17 00:00:00 2001 From: Sungkeun Cho Date: Thu, 24 Jan 2019 03:09:23 -0800 Subject: [PATCH] [inferbo] Add test for contents of std::array Reviewed By: mbouaziz Differential Revision: D13800142 fbshipit-source-id: c8a2be87b --- .../codetoanalyze/cpp/bufferoverrun/std_array.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/infer/tests/codetoanalyze/cpp/bufferoverrun/std_array.cpp b/infer/tests/codetoanalyze/cpp/bufferoverrun/std_array.cpp index 7440e710d..aba4ad3ba 100644 --- a/infer/tests/codetoanalyze/cpp/bufferoverrun/std_array.cpp +++ b/infer/tests/codetoanalyze/cpp/bufferoverrun/std_array.cpp @@ -39,3 +39,15 @@ void new_int3_Bad() { int32_t* dst; dst = new int32_t[len]; } + +void std_array_contents_Good() { + std::array a; + a[0] = 5; + a[a[0]] = 0; +} + +void std_array_contents_Bad_FN() { + std::array a; + a[0] = 10; + a[a[0]] = 0; +}