[quandary] tests for passthroughs

Summary: Making sure simple passthroughs like the identity function work in C++.

Reviewed By: mbouaziz

Differential Revision: D5024031

fbshipit-source-id: ce48ead
master
Sam Blackshear 8 years ago committed by Facebook Github Bot
parent 7bc2d6de12
commit 28bc279cdc

@ -106,4 +106,28 @@ void via_field_ok2() {
obj->field1 = *template_source<std::string>(); obj->field1 = *template_source<std::string>();
template_sink<std::string>(obj->field2); template_sink<std::string>(obj->field2);
} }
template <class T>
T* id1(T* t) {
return t;
}
template <class T>
T id2(T t) {
return t;
}
void via_passthrough_bad1(Obj* obj) {
std::string source = obj->string_source(0);
std::string* source_ptr = &source;
std::string* laundered_source = id1<std::string>(source_ptr);
obj->string_sink(*laundered_source);
}
// the summary for id2 doesn't assign to the return value
void FN_via_passthrough_bad2(Obj* obj) {
std::string source = obj->string_source(0);
std::string laundered_source = id2<std::string>(source);
obj->string_sink(laundered_source);
}
} }

@ -8,6 +8,7 @@ codetoanalyze/cpp/quandary/basics.cpp, basics::string_source_bad, 2, QUANDARY_TA
codetoanalyze/cpp/quandary/basics.cpp, basics::template_source_bad, 2, QUANDARY_TAINT_ERROR, [return from basics::template_source<void_*>,call to __infer_taint_sink] codetoanalyze/cpp/quandary/basics.cpp, basics::template_source_bad, 2, QUANDARY_TAINT_ERROR, [return from basics::template_source<void_*>,call to __infer_taint_sink]
codetoanalyze/cpp/quandary/basics.cpp, basics::via_field_bad1, 3, QUANDARY_TAINT_ERROR, [return from basics::template_source<std::basic_string<char>_>,call to basics::template_sink<std::basic_string<char>_>] codetoanalyze/cpp/quandary/basics.cpp, basics::via_field_bad1, 3, QUANDARY_TAINT_ERROR, [return from basics::template_source<std::basic_string<char>_>,call to basics::template_sink<std::basic_string<char>_>]
codetoanalyze/cpp/quandary/basics.cpp, basics::via_field_bad2, 2, QUANDARY_TAINT_ERROR, [return from basics::template_source<std::basic_string<char>_>,call to basics::template_sink<std::basic_string<char>_>] codetoanalyze/cpp/quandary/basics.cpp, basics::via_field_bad2, 2, QUANDARY_TAINT_ERROR, [return from basics::template_source<std::basic_string<char>_>,call to basics::template_sink<std::basic_string<char>_>]
codetoanalyze/cpp/quandary/basics.cpp, basics::via_passthrough_bad1, 4, QUANDARY_TAINT_ERROR, [return from basics::Obj_string_source,flow through basics::id1<std::basic_string<char>_>,call to basics::Obj_string_sink]
codetoanalyze/cpp/quandary/execs.cpp, execs::callExecBad, 6, QUANDARY_TAINT_ERROR, [return from getenv,call to execl] codetoanalyze/cpp/quandary/execs.cpp, execs::callExecBad, 6, QUANDARY_TAINT_ERROR, [return from getenv,call to execl]
codetoanalyze/cpp/quandary/execs.cpp, execs::callExecBad, 8, QUANDARY_TAINT_ERROR, [return from getenv,call to execl] codetoanalyze/cpp/quandary/execs.cpp, execs::callExecBad, 8, QUANDARY_TAINT_ERROR, [return from getenv,call to execl]
codetoanalyze/cpp/quandary/execs.cpp, execs::callExecBad, 11, QUANDARY_TAINT_ERROR, [return from getenv,call to execl] codetoanalyze/cpp/quandary/execs.cpp, execs::callExecBad, 11, QUANDARY_TAINT_ERROR, [return from getenv,call to execl]

Loading…
Cancel
Save