|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Web; |
| 4 | + |
| 5 | +public class SupportedExternalApis |
| 6 | +{ |
| 7 | + public void M1() |
| 8 | + { |
| 9 | + var l = new List<object>(); // Uninteresting parameterless constructor |
| 10 | + var o = new object(); // Uninteresting parameterless constructor |
| 11 | + l.Add(o); // Has flow summary |
| 12 | + l.Add(o); // Has flow summary |
| 13 | + } |
| 14 | + |
| 15 | + public void M2() |
| 16 | + { |
| 17 | + var d0 = new DateTime(); // Uninteresting parameterless constructor |
| 18 | + var next0 = d0.AddYears(30); // Has no flow summary, supported as negative summary |
| 19 | + |
| 20 | + var d1 = new DateTime(2000, 1, 1); // Interesting constructor, supported as negative summary |
| 21 | + var next1 = next0.AddDays(3); // Has no flow summary, supported as negative summary |
| 22 | + var next2 = next1.AddYears(5); // Has no flow summary, supported as negative summary |
| 23 | + } |
| 24 | + |
| 25 | + public void M3() |
| 26 | + { |
| 27 | + var guid1 = Guid.Parse("{12345678-1234-1234-1234-123456789012}"); // Has no flow summary, supported as negative summary |
| 28 | + } |
| 29 | + |
| 30 | + public void M4() |
| 31 | + { |
| 32 | + var o = new object(); // Uninteresting parameterless constructor |
| 33 | + var response = new HttpResponse(); // Uninteresting parameterless constructor |
| 34 | + response.AddHeader("header", "value"); // Unsupported |
| 35 | + response.AppendHeader("header", "value"); // Unsupported |
| 36 | + response.Write(o); // Known sink |
| 37 | + response.WriteFile("filename"); // Known sink |
| 38 | + response.Write(o); // Known sink |
| 39 | + } |
| 40 | + |
| 41 | + public void M5() |
| 42 | + { |
| 43 | + var l1 = Console.ReadLine(); // Known source |
| 44 | + var l2 = Console.ReadLine(); // Known source |
| 45 | + Console.SetError(Console.Out); // Has no flow summary, supported as negative summary |
| 46 | + var x = Console.Read(); // Known source |
| 47 | + } |
| 48 | +} |
0 commit comments