File tree Expand file tree Collapse file tree
lib/semmle/code/cpp/models
test/library-tests/dataflow/taint-tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,3 +52,4 @@ private import implementations.ZMQ
5252private import implementations.Win32CommandExecution
5353private import implementations.CA2AEX
5454private import implementations.CComBSTR
55+ private import implementations.CPathT
Original file line number Diff line number Diff line change 1+ private import cpp
2+ private import semmle.code.cpp.ir.dataflow.FlowSteps
3+ private import semmle.code.cpp.dataflow.new.DataFlow
4+
5+ /** The `CPathT` class from the Microsoft "Active Template Library". */
6+ class CPathT extends Class {
7+ CPathT ( ) { this .hasGlobalName ( "CPathT" ) }
8+ }
9+
10+ private class MStrPath extends Field {
11+ MStrPath ( ) { this .getDeclaringType ( ) instanceof CPathT and this .hasName ( "m_strPath" ) }
12+ }
13+
14+ private class MStrPathTaintInheritingContent extends TaintInheritingContent , DataFlow:: FieldContent {
15+ MStrPathTaintInheritingContent ( ) { this .getField ( ) instanceof MStrPath }
16+ }
Original file line number Diff line number Diff line change @@ -664,45 +664,45 @@ void test_CPathT() {
664664 char * x = indirect_source<char >();
665665 CPath p (x);
666666 sink (static_cast <char *>(p)); // $ MISSING: ir
667- sink (p.m_strPath ); // $ MISSING: ir
667+ sink (p.m_strPath ); // $ ir
668668
669669 CPath p2 (p);
670- sink (p2.m_strPath ); // $ MISSING: ir
670+ sink (p2.m_strPath ); // $ ir
671671
672672 {
673673 CPath p;
674674 p.AddExtension (x);
675- sink (p.m_strPath ); // $ MISSING: ir
675+ sink (p.m_strPath ); // $ ir
676676 }
677677 {
678678 CPath p;
679679 p.Append (x);
680- sink (p.m_strPath ); // $ MISSING: ir
680+ sink (p.m_strPath ); // $ ir
681681
682682 CPath p2;
683683 p2 += p;
684- sink (p.m_strPath ); // $ MISSING: ir
684+ sink (p.m_strPath ); // $ ir
685685
686686 CPath p3;
687687 p3 += x;
688- sink (p.m_strPath ); // $ MISSING: ir
688+ sink (p.m_strPath ); // $ ir
689689 }
690690
691691 {
692692 CPath p;
693693 p.Combine (x, nullptr );
694- sink (p.m_strPath ); // $ MISSING: ir
694+ sink (p.m_strPath ); // $ ir
695695 }
696696 {
697697 CPath p;
698698 p.Combine (nullptr , x);
699- sink (p.m_strPath ); // $ MISSING: ir
699+ sink (p.m_strPath ); // $ ir
700700 }
701701
702702 {
703703 CPath p;
704704 auto p2 = p.CommonPrefix (x);
705- sink (p2.m_strPath ); // $ MISSING: ir
705+ sink (p2.m_strPath ); // $ ir
706706 sink (p2.GetExtension ()); // $ ir
707707 }
708708}
You can’t perform that action at this time.
0 commit comments