Presentation is loading. Please wait.

Presentation is loading. Please wait.

Giulia Costantini¹, Pietro Ferrara², Agostino Cortesi¹ ² ETH Zurich Switzerland ICFEM 2011, Durham, England ¹ Università Ca’ Foscari Venice, Italy Static.

Similar presentations


Presentation on theme: "Giulia Costantini¹, Pietro Ferrara², Agostino Cortesi¹ ² ETH Zurich Switzerland ICFEM 2011, Durham, England ¹ Università Ca’ Foscari Venice, Italy Static."— Presentation transcript:

1 Giulia Costantini¹, Pietro Ferrara², Agostino Cortesi¹ ² ETH Zurich Switzerland ICFEM 2011, Durham, England ¹ Università Ca’ Foscari Venice, Italy Static Analysis of String Values

2 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Strings Strings are everywhere: >SQL queries >Reflection Wrong use could have catastrophic effects

3 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Sound static analysis Prove properties >at compile time (static) >respected by all executions (sound) Abstract interpretation >Cousot&Cousot 77/79 >Mathematical framework to Define the semantics Soundly approximate it >Ideal goal: fast and precise abstraction

4 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Bases of abstract interpretation ConcreteAbstract {1, 5, 8} +0- ⊤ ⊥ {…, -1, 0, 1, ….} {1, 2, ….} Abstraction Concretization ∅

5 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Semantics ConcreteAbstract + 0- ⊤ ⊥ {2, 6, 9} x++ {1, 5, 8} {…, -1, 0, 1, ….} {1, 2, ….} ∅

6 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Upper bound ConcreteAbstract {0} + 0- ⊤ ⊥ {0, 1} ∅ {1} if(…) x=0; else x=1; {…, -1, 0, 1, ….}

7 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Numerical analyses Common interface for several analyses Semantics of +, -, *, /, constants, … + 0- ⊤ ⊥ x++ Odd Even ⊤ ⊥ x++ [0..3][1..4] x++

8 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Outline 1.Introduction 2.Generic framework for string analysis 3.String domains a)Character inclusion b)Prefix and suffix c)Bricks d)String graphs 4.Conclusion

9 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England String operators Set of standard operators on strings: > new String(“str”) or “str” > concat(s1, s2) or s1+s2 > readLine() > substring(b, e, s) > contains(c, s) Each domain has a lattice structure

10 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Running example string x = "a"; while(…) x = "0" + x + "1"; return x; Because of approximation/user input/…

11 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Outline 1.Introduction 2.Generic framework for string analysis 3.String domains a)Character inclusion b)Prefix and suffix c)Bricks d)String graphs 4.Conclusion

12 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Character inclusion Strings approximated through >C: characters surely contained >MC: characters possibly contained ConcreteAbstract CMC

13 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Character inclusion – Running example Concretization string x = "a"; while(…) x = "0" + x + "1"; return x;

14 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Prefix & Suffix Strings approximated through >PR: prefix of the string >SU: suffix of the string ConcreteAbstract PRSU

15 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Prefix & Suffix – Running example Concretization string x = "a"; while(…) x = "0" + x + "1"; return x;

16 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Bricks ConcreteAbstract

17 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Bricks – Running example Concretization string x = "a"; while(…) x = "0" + x + "1"; return x; Widening!

18 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England String graphs Adaptation of type graphs (tree automata) >Rely on their normalization and widening ConcreteAbstract

19 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England String graphs – Running example = string x = "a"; while(…) x = "0" + x + "1"; return x; =

20 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England String graphs – Running example string x = "a"; while(…) x = "0" + x + "1"; return x; =

21 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England String graphs – Running example string x = "a"; while(…) x = "0" + x + "1"; return x; Normalization

22 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England String graphs – Running example string x = "a"; while(…) x = "0" + x + "1"; return x; Concretization Widening!

23 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Outline 1.Introduction 2.Generic framework for string analysis 3.String domains a)Character inclusion b)Prefix and suffix c)Bricks d)String graphs 4.Conclusion

24 G. Costantini, P. Ferrara, and A. Cortesi: “Static Analysis of String Values” ICFEM, Durham, England Conclusion CharactersOrderComplexity Character inclusion  Prefix and suffix  Bricks  String graphs 


Download ppt "Giulia Costantini¹, Pietro Ferrara², Agostino Cortesi¹ ² ETH Zurich Switzerland ICFEM 2011, Durham, England ¹ Università Ca’ Foscari Venice, Italy Static."

Similar presentations


Ads by Google