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

CodeQL reports potential double free in XML parser #8262

Open
tautschnig opened this issue Apr 26, 2024 · 1 comment
Open

CodeQL reports potential double free in XML parser #8262

tautschnig opened this issue Apr 26, 2024 · 1 comment

Comments

@tautschnig
Copy link
Collaborator

https://github.com/diffblue/cbmc/security/code-scanning/4 reports a double free without giving a detailed example or trace. Trying to reproduce a free at source line 1235 on Ubuntu 22.04 (Bison 3.8.2) is failing for me for that line is just blank. It is still possible that CodeQL is right for the XML parser does use free in a couple of places. Likely requires setting up CodeQL CLI to reproduce with local source code.

@kroening
Copy link
Member

It's in this rule:
attribute : NAME EQ VALUE { xml_parser.current().set_attribute( xmlt::unescape($1), xmlt::unescape($3)); free($1); free($3);} ;
xmlt::unescape takes an std::string, so copies. Tough to see where the double-free happens. It may well be the case that CodeQL can't distinguish $1 from $3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants