What Is Decidable about String Constraints with the ReplaceAll Function

被引:36
|
作者
Chen, Taolue [1 ]
Chen, Yan [2 ,3 ]
Hague, Matthew [4 ]
Lin, Anthony W. [5 ]
Wu, Zhilin [2 ]
机构
[1] Birkbeck Univ London, Dept Comp Sci & Informat Syst, Malet St, London WC1E 7HX, England
[2] Chinese Acad Sci, Inst Software, State Key Lab Comp Sci, Beijing, Peoples R China
[3] Univ Chinese Acad Sci, Beijing, Peoples R China
[4] Royal Holloway Univ London, Dept Comp Sci, Egham Hill, Egham TW20 0EX, Surrey, England
[5] Univ Oxford, Dept Comp Sci, Wolfson Buildin,Parks Rd, Oxford OX1 3QD, England
来源
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL | 2018年 / 2卷
基金
澳大利亚研究理事会; 英国工程与自然科学研究理事会; 欧洲研究理事会; 中国国家自然科学基金;
关键词
String Constraints; ReplaceAll; Decision Procedures; Constraint Solving; Straight-Line Programs;
D O I
10.1145/3158091
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
The theory of strings with concatenation has been widely argued as the basis of constraint solving for verifying string-manipulating programs. However, this theory is far from adequate for expressing many string constraints that are also needed in practice; for example, the use of regular constraints (pattern matching against a regular expression), and the string-replace function (replacing either the first occurrence or all occurrences of a "pattern" string constant/variable/regular expression by a "replacement" string constant/variable), among many others. Both regular constraints and the string-replace function are crucial for such applications as analysis of JavaScript (or more generally HTML5 applications) against cross-site scripting (XSS) vulnerabilities, which motivates us to consider a richer class of string constraints. The importance of the string-replace function (especially the replace-all facility) is increasingly recognised, which can be witnessed by the incorporation of the function in the input languages of several string constraint solvers. Recently, it was shown that any theory of strings containing the string-replace function (even the most restricted version where pattern/replacement strings are both constant strings) becomes undecidable if we do not impose some kind of straight-line (aka acyclicity) restriction on the formulas. Despite this, the straight-line restriction is still practically sensible since this condition is typically met by string constraints that are generated by symbolic execution. In this paper, we provide the first systematic study of straight-line string constraints with the string-replace function and the regular constraints as the basic operations. We show that a large class of such constraints (i.e. when only a constant string or a regular expression is permitted in the pattern) is decidable. We note that the string-replace function, even under this restriction, is sufficiently powerful for expressing the concatenation operator and much more (e.g. extensions of regular expressions with string variables). This gives us the most expressive decidable logic containing concatenation, replace, and regular constraints under the same umbrella. Our decision procedure for the straight-line fragment follows an automata-theoretic approach, and is modular in the sense that the string-replace terms are removed one by one to generate more and more regular constraints, which can then be discharged by the state-of-the-art string constraint solvers. We also show that this fragment is, in a way, a maximal decidable subclass of the straight-line fragment with string-replace and regular constraints. To this end, we show undecidability results for the following two extensions: (1) variables are permitted in the pattern parameter of the replace function, (2) length constraints are permitted.
引用
收藏
页数:29
相关论文
共 14 条
  • [1] What's Decidable about Sequences?
    Furia, Carlo A.
    AUTOMATED TECHNOLOGY FOR VERIFICATION AND ANALYSIS, 2010, 6252 : 128 - 142
  • [2] Simple linear string constraints
    Fu, Xiang
    Powell, Michael C.
    Bantegui, Michael
    Li, Chung-Chih
    FORMAL ASPECTS OF COMPUTING, 2013, 25 (06) : 847 - 891
  • [3] HAMPI: A Solver for String Constraints
    Kiezun, Adam
    Ganesh, Vijay
    Guo, Philip J.
    Hooimeijer, Pieter
    Ernst, Michael D.
    ISSTA 2009: INTERNATIONAL SYMPOSIUM ON SOFTWARE TESTING AND ANALYSIS, 2009, : 105 - 115
  • [4] On the Expressive Power of String Constraints
    Day, Joel D.
    Ganesh, Vijay
    Grewal, Nathan
    Manea, Florin
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2023, 7 (POPL):
  • [5] An efficient string solver for string constraints with regex-counting and string-length
    Hu, Denghang
    Wu, Zhilin
    JOURNAL OF SYSTEMS ARCHITECTURE, 2025, 160
  • [6] What Is Decidable in Separation Logic Beyond Progress, Connectivity and Establishment?
    Bozec, Tanguy
    Peltier, Nicolas
    Petitjean, Quentin
    Sighireanu, Mihaela
    AUTOMATED REASONING, IJCAR 2024, PT II, 2024, 14740 : 157 - 175
  • [7] Chain-Free String Constraints
    Abdulla, Parosh Aziz
    Atig, Mohamed Faouzi
    Bui Phi Diep
    Holik, Lukas
    Janku, Petr
    AUTOMATED TECHNOLOGY FOR VERIFICATION AND ANALYSIS (ATVA 2019), 2019, 11781 : 277 - 293
  • [8] Solving String Constraints with Lengths by Stabilization
    Chen, Yu-Fang
    Chocholaty, David
    Havlena, Vojtech
    Holik, Lukas
    Lengal, Ondrej
    Sic, Juraj
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2023, 7 (OOPSLA):
  • [9] Parameterized Model Counting for String and Numeric Constraints
    Aydin, Abdulbaki
    Eiers, William
    Bang, Lucas
    Brennan, Tegan
    Gavrilov, Miroslav
    Bultan, Tevfik
    Yu, Fang
    ESEC/FSE'18: PROCEEDINGS OF THE 2018 26TH ACM JOINT MEETING ON EUROPEAN SOFTWARE ENGINEERING CONFERENCE AND SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING, 2018, : 400 - 410
  • [10] Semenov Arithmetic, Affine VASS, and String Constraints
    Draghici, Andrei
    Haase, Christoph
    Manea, Florin
    41ST INTERNATIONAL SYMPOSIUM ON THEORETICAL ASPECTS OF COMPUTER SCIENCE, STACS 2024, 2024, 289