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

Illegal usage of ofstream with nullptr as filename #16

Closed
futile opened this issue May 8, 2020 · 1 comment
Closed

Illegal usage of ofstream with nullptr as filename #16

futile opened this issue May 8, 2020 · 1 comment

Comments

@futile
Copy link

futile commented May 8, 2020

In https://github.com/ldn-softdev/jtc/blob/master/jtc.cpp#L662-L663, an ofstream is initialized with a nullptr when no output filename is given. This is illegal, as this constructor of ofstream internally calls std::basic_filebuf::open(), which expects a pointer to a null-terminated string (see https://en.cppreference.com/w/cpp/io/basic_ofstream/basic_ofstream and https://en.cppreference.com/w/cpp/io/basic_filebuf/open).

This bug was found using Symbolic Execution techniques developed in the course of the SYMBIOSYS research project at COMSYS, RWTH Aachen University. This research is supported by the European Research Council (ERC) under the EU's Horizon 2020 Research and Innovation Programme grant agreement n. 647295 (SYMBIOSYS).

@ldn-softdev
Copy link
Owner

yes, agree, it might be a problem with some implementations (though for macos it's fine), I'll also update the fix for a safety of the code,
thank you very much!

ldn-softdev pushed a commit that referenced this issue May 8, 2020
ldn-softdev pushed a commit that referenced this issue May 8, 2020
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