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

Improve the model for argc and argv #133

Open
arthaud opened this issue Jul 10, 2019 · 0 comments
Open

Improve the model for argc and argv #133

arthaud opened this issue Jul 10, 2019 · 0 comments
Labels
C-false-positive Category: False Positive L-c Language: C P-low Priority: Low

Comments

@arthaud
Copy link
Member

arthaud commented Jul 10, 2019

On the following example:

#include <stdio.h>

int main(int argc, char** argv) {
    if (argc < 2) {
        return 0;
    }

    printf("Hello, %s", argv[1]);
    return 0;
}

IKOS generates the following warnings:

test.c: In function 'main':
test.c:8:5: warning: memory access might be invalid, could not infer information about pointer 'argv[1]'
    printf("Hello, %s", argv[1]);
    ^
test.c: In function 'main':
test.c:8:25: warning: possible buffer overflow, pointer '&argv[1]' accesses 8 bytes at offset 8 bytes of 'argv'
    printf("Hello, %s", argv[1]);
                        ^

We need to model argc/argv properly to get rid of these warnings. This seems complicated to achieve for non-relational numerical domains.

@arthaud arthaud added C-false-positive Category: False Positive L-c Language: C P-low Priority: Low labels Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-false-positive Category: False Positive L-c Language: C P-low Priority: Low
Projects
None yet
Development

No branches or pull requests

1 participant