Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbolic Model 'strcmp' (null chars) #2538

Open
frediramos opened this issue Mar 7, 2022 · 0 comments
Open

Symbolic Model 'strcmp' (null chars) #2538

frediramos opened this issue Mar 7, 2022 · 0 comments
Labels

Comments

@frediramos
Copy link

Summary of the problem

Ths symbolic model for the strcmp function (line 99) does not take into account that intermediate symbolic bytes from both strings can also be null characters. This leads to both missing and incorrect execution paths with regard to strcmp's specification.

Example

Consider, for instance, two symbolic input string composed by 3 symbolic bytes:

str1 = "| sym1 | sym2 | sym3 |x00"
str2 = "| sym4 | sym5 | sym6 |x00"

The model for this function produces the following ITE formula:
ret = ITE(sym1 ̸= sym4 , sym1 − sym4 , ITE(sym2 ̸= sym5, sym2 − sym5, ITE(sym3 ̸= sym6, sym3 − sym6, 0)))

This formula allows for missing and incorrect path as exemplified below:

Missing path

str1 = "| A | x00 | B |x00"
str2 = "| A | x00 | A |x00"
ret = 0

Wrong path

str1 = "| x00 | A | B |x00"
str2 = "| x00 | A | A |x00"
ret = 1

We agree that function models/summaries should be kept simple, but we believe that every model should either contain all correct paths, or not contain any incorrect path.

@frediramos frediramos added the bug label Mar 7, 2022
@frediramos frediramos changed the title Symbolic Model 'strcmp' (null bytes) Symbolic Model 'strcmp' (null chars) Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant