@@ -535,207 +535,8 @@ class SystemIOStringReaderFlow extends LibraryTypeDataFlow, SystemIOStringReader
535535 }
536536}
537537
538- /** Data flow for `System.String`. */
539- class SystemStringFlow extends LibraryTypeDataFlow , SystemStringClass {
540- override predicate callableFlow (
541- CallableFlowSource source , AccessPath sourceAp , CallableFlowSink sink , AccessPath sinkAp ,
542- SourceDeclarationCallable c , boolean preservesValue
543- ) {
544- this .constructorFlow ( source , sourceAp , sink , sinkAp , c ) and
545- preservesValue = false
546- or
547- this .methodFlow ( source , sourceAp , sink , sinkAp , c , preservesValue )
548- }
549-
550- private predicate constructorFlow (
551- CallableFlowSource source , AccessPath sourceAp , CallableFlowSink sink , AccessPath sinkAp ,
552- Constructor c
553- ) {
554- c = this .getAMember ( ) and
555- c .getParameter ( 0 ) .getType ( ) .( ArrayType ) .getElementType ( ) instanceof CharType and
556- source = TCallableFlowSourceArg ( 0 ) and
557- sourceAp = AccessPath:: element ( ) and
558- sink = TCallableFlowSinkReturn ( ) and
559- sinkAp = AccessPath:: empty ( )
560- }
561-
562- private predicate methodFlow (
563- CallableFlowSource source , AccessPath sourceAp , CallableFlowSink sink , AccessPath sinkAp ,
564- SourceDeclarationMethod m , boolean preservesValue
565- ) {
566- m = this .getAMethod ( "ToString" ) and
567- source = TCallableFlowSourceQualifier ( ) and
568- sourceAp = AccessPath:: empty ( ) and
569- sink = TCallableFlowSinkReturn ( ) and
570- sinkAp = AccessPath:: empty ( ) and
571- preservesValue = true
572- or
573- m = this .getSplitMethod ( ) and
574- source = TCallableFlowSourceQualifier ( ) and
575- sourceAp = AccessPath:: empty ( ) and
576- sink = TCallableFlowSinkReturn ( ) and
577- sinkAp = AccessPath:: element ( ) and
578- preservesValue = false
579- or
580- m = this .getReplaceMethod ( ) and
581- sourceAp = AccessPath:: empty ( ) and
582- sinkAp = AccessPath:: empty ( ) and
583- (
584- source = TCallableFlowSourceQualifier ( ) and
585- sink = TCallableFlowSinkReturn ( ) and
586- preservesValue = false
587- or
588- source = TCallableFlowSourceArg ( 1 ) and
589- sink = TCallableFlowSinkReturn ( ) and
590- preservesValue = false
591- )
592- or
593- m = this .getSubstringMethod ( ) and
594- source = TCallableFlowSourceQualifier ( ) and
595- sourceAp = AccessPath:: empty ( ) and
596- sink = TCallableFlowSinkReturn ( ) and
597- sinkAp = AccessPath:: empty ( ) and
598- preservesValue = false
599- or
600- m = this .getCloneMethod ( ) and
601- source = TCallableFlowSourceQualifier ( ) and
602- sourceAp = AccessPath:: empty ( ) and
603- sink = TCallableFlowSinkReturn ( ) and
604- sinkAp = AccessPath:: empty ( ) and
605- preservesValue = true
606- or
607- m = this .getInsertMethod ( ) and
608- sourceAp = AccessPath:: empty ( ) and
609- sinkAp = AccessPath:: empty ( ) and
610- (
611- source = TCallableFlowSourceQualifier ( ) and
612- sink = TCallableFlowSinkReturn ( ) and
613- preservesValue = false
614- or
615- source = TCallableFlowSourceArg ( 1 ) and
616- sink = TCallableFlowSinkReturn ( ) and
617- preservesValue = false
618- )
619- or
620- m = this .getNormalizeMethod ( ) and
621- source = TCallableFlowSourceQualifier ( ) and
622- sourceAp = AccessPath:: empty ( ) and
623- sink = TCallableFlowSinkReturn ( ) and
624- sinkAp = AccessPath:: empty ( ) and
625- preservesValue = false
626- or
627- m = this .getRemoveMethod ( ) and
628- source = TCallableFlowSourceQualifier ( ) and
629- sourceAp = AccessPath:: empty ( ) and
630- sink = TCallableFlowSinkReturn ( ) and
631- sinkAp = AccessPath:: empty ( ) and
632- preservesValue = false
633- or
634- m = this .getAMethod ( ) and
635- m .getName ( ) .regexpMatch ( "((ToLower|ToUpper)(Invariant)?)|(Trim(Start|End)?)|(Pad(Left|Right))" ) and
636- source = TCallableFlowSourceQualifier ( ) and
637- sourceAp = AccessPath:: empty ( ) and
638- sink = TCallableFlowSinkReturn ( ) and
639- sinkAp = AccessPath:: empty ( ) and
640- preservesValue = false
641- or
642- m = this .getConcatMethod ( ) and
643- exists ( int i |
644- source = getFlowSourceArg ( m , i , sourceAp ) and
645- sink = TCallableFlowSinkReturn ( ) and
646- sinkAp = AccessPath:: empty ( ) and
647- preservesValue = false
648- )
649- or
650- m = this .getCopyMethod ( ) and
651- source = TCallableFlowSourceArg ( 0 ) and
652- sourceAp = AccessPath:: empty ( ) and
653- sink = TCallableFlowSinkReturn ( ) and
654- sinkAp = AccessPath:: empty ( ) and
655- preservesValue = true
656- or
657- m = this .getJoinMethod ( ) and
658- source = getFlowSourceArg ( m , [ 0 , 1 ] , sourceAp ) and
659- sink = TCallableFlowSinkReturn ( ) and
660- sinkAp = AccessPath:: empty ( ) and
661- preservesValue = false
662- or
663- m = this .getFormatMethod ( ) and
664- exists ( int i |
665- ( m .getParameter ( 0 ) .getType ( ) instanceof SystemIFormatProviderInterface implies i != 0 ) and
666- source = getFlowSourceArg ( m , i , sourceAp ) and
667- sink = TCallableFlowSinkReturn ( ) and
668- sinkAp = AccessPath:: empty ( ) and
669- preservesValue = false
670- )
671- }
672- }
673-
674538/** Data flow for `System.Text.StringBuilder`. */
675539class SystemTextStringBuilderFlow extends LibraryTypeDataFlow , SystemTextStringBuilderClass {
676- override predicate callableFlow (
677- CallableFlowSource source , AccessPath sourceAp , CallableFlowSink sink , AccessPath sinkAp ,
678- SourceDeclarationCallable c , boolean preservesValue
679- ) {
680- (
681- this .constructorFlow ( source , sourceAp , sink , sinkAp , c ) and
682- preservesValue = true
683- or
684- this .methodFlow ( source , sourceAp , sink , sinkAp , c , preservesValue )
685- )
686- }
687-
688- private predicate constructorFlow (
689- CallableFlowSource source , AccessPath sourceAp , CallableFlowSink sink , AccessPath sinkAp ,
690- Constructor c
691- ) {
692- c = this .getAMember ( ) and
693- c .getParameter ( 0 ) .getType ( ) instanceof StringType and
694- source = TCallableFlowSourceArg ( 0 ) and
695- sourceAp = AccessPath:: empty ( ) and
696- sink = TCallableFlowSinkReturn ( ) and
697- sinkAp = AccessPath:: element ( )
698- }
699-
700- private predicate methodFlow (
701- CallableFlowSource source , AccessPath sourceAp , CallableFlowSink sink , AccessPath sinkAp ,
702- SourceDeclarationMethod m , boolean preservesValue
703- ) {
704- exists ( string name | m = this .getAMethod ( ) and m .hasUndecoratedName ( name ) |
705- name = "ToString" and
706- source = TCallableFlowSourceQualifier ( ) and
707- sourceAp = AccessPath:: element ( ) and
708- sink = TCallableFlowSinkReturn ( ) and
709- sinkAp = AccessPath:: empty ( ) and
710- preservesValue = false
711- or
712- name .regexpMatch ( "Append(Format|Line|Join)?" ) and
713- preservesValue = true and
714- (
715- exists ( int i , Type t |
716- t = m .getParameter ( i ) .getType ( ) and
717- source = TCallableFlowSourceArg ( i ) and
718- sink = TCallableFlowSinkQualifier ( ) and
719- sinkAp = AccessPath:: element ( )
720- |
721- (
722- t instanceof StringType or
723- t instanceof ObjectType
724- ) and
725- sourceAp = AccessPath:: empty ( )
726- or
727- isCollectionType ( t ) and
728- sourceAp = AccessPath:: element ( )
729- )
730- or
731- source = TCallableFlowSourceQualifier ( ) and
732- sourceAp = AccessPath:: empty ( ) and
733- sink = TCallableFlowSinkReturn ( ) and
734- sinkAp = AccessPath:: empty ( )
735- )
736- )
737- }
738-
739540 override predicate clearsContent (
740541 CallableFlowSource source , Content content , SourceDeclarationCallable callable
741542 ) {
@@ -745,74 +546,6 @@ class SystemTextStringBuilderFlow extends LibraryTypeDataFlow, SystemTextStringB
745546 }
746547}
747548
748- /** Data flow for `System.Lazy<>`. */
749- class SystemLazyFlow extends LibraryTypeDataFlow , SystemLazyClass {
750- override predicate callableFlow (
751- CallableFlowSource source , AccessPath sourceAp , CallableFlowSink sink , AccessPath sinkAp ,
752- SourceDeclarationCallable c , boolean preservesValue
753- ) {
754- preservesValue = true and
755- exists ( SystemFuncDelegateType t , int i | t .getNumberOfTypeParameters ( ) = 1 |
756- c .( Constructor ) .getDeclaringType ( ) = this and
757- c .getParameter ( i ) .getType ( ) .getUnboundDeclaration ( ) = t and
758- source = getDelegateFlowSourceArg ( c , i ) and
759- sourceAp = AccessPath:: empty ( ) and
760- sink = TCallableFlowSinkReturn ( ) and
761- sinkAp = AccessPath:: property ( this .getValueProperty ( ) )
762- )
763- or
764- preservesValue = false and
765- c = this .getValueProperty ( ) .getGetter ( ) and
766- source = TCallableFlowSourceQualifier ( ) and
767- sourceAp = AccessPath:: empty ( ) and
768- sink = TCallableFlowSinkReturn ( ) and
769- sinkAp = AccessPath:: empty ( )
770- }
771- }
772-
773- /** Data flow for `System.Nullable<>`. */
774- class SystemNullableFlow extends LibraryTypeDataFlow , SystemNullableStruct {
775- override predicate callableFlow (
776- CallableFlowSource source , AccessPath sourceAp , CallableFlowSink sink , AccessPath sinkAp ,
777- SourceDeclarationCallable c , boolean preservesValue
778- ) {
779- preservesValue = true and
780- c .( Constructor ) .getDeclaringType ( ) = this and
781- source = getFlowSourceArg ( c , 0 , sourceAp ) and
782- sourceAp = AccessPath:: empty ( ) and
783- sink = TCallableFlowSinkReturn ( ) and
784- sinkAp = AccessPath:: property ( this .getValueProperty ( ) )
785- or
786- preservesValue = true and
787- c = this .getAGetValueOrDefaultMethod ( ) and
788- source = TCallableFlowSourceQualifier ( ) and
789- sourceAp = AccessPath:: property ( this .getValueProperty ( ) ) and
790- sink = TCallableFlowSinkReturn ( ) and
791- sinkAp = AccessPath:: empty ( )
792- or
793- preservesValue = false and
794- c = this .getHasValueProperty ( ) .getGetter ( ) and
795- source = TCallableFlowSourceQualifier ( ) and
796- sourceAp = AccessPath:: property ( this .getValueProperty ( ) ) and
797- sink = TCallableFlowSinkReturn ( ) and
798- sinkAp = AccessPath:: empty ( )
799- or
800- preservesValue = true and
801- c = this .getAGetValueOrDefaultMethod ( ) and
802- source = getFlowSourceArg ( c , 0 , _) and
803- sourceAp = AccessPath:: empty ( ) and
804- sink = TCallableFlowSinkReturn ( ) and
805- sinkAp = AccessPath:: empty ( )
806- or
807- preservesValue = false and
808- c = this .getValueProperty ( ) .getGetter ( ) and
809- source = TCallableFlowSourceQualifier ( ) and
810- sourceAp = AccessPath:: empty ( ) and
811- sink = TCallableFlowSinkReturn ( ) and
812- sinkAp = AccessPath:: empty ( )
813- }
814- }
815-
816549/** Data flow for `System.Collections.IEnumerable` (and sub types). */
817550class IEnumerableFlow extends LibraryTypeDataFlow , RefType {
818551 IEnumerableFlow ( ) { this .getABaseType * ( ) instanceof SystemCollectionsIEnumerableInterface }
@@ -1597,25 +1330,6 @@ class IDictionaryFlow extends LibraryTypeDataFlow, RefType {
15971330 }
15981331}
15991332
1600- /** Data flow for `System.Convert`. */
1601- class SystemConvertFlow extends LibraryTypeDataFlow , SystemConvertClass {
1602- override predicate callableFlow (
1603- CallableFlowSource source , CallableFlowSink sink , SourceDeclarationCallable c ,
1604- boolean preservesValue
1605- ) {
1606- this .methodFlow ( source , sink , c ) and
1607- preservesValue = false
1608- }
1609-
1610- private predicate methodFlow (
1611- CallableFlowSource source , CallableFlowSink sink , SourceDeclarationMethod m
1612- ) {
1613- m = this .getAMethod ( ) and
1614- source = TCallableFlowSourceArg ( 0 ) and
1615- sink = TCallableFlowSinkReturn ( )
1616- }
1617- }
1618-
16191333/** Data flow for `System.Web.HttpCookie`. */
16201334class SystemWebHttpCookieFlow extends LibraryTypeDataFlow , SystemWebHttpCookie {
16211335 override predicate callableFlow (
0 commit comments