3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-05-12 02:04:44 +00:00

gzip: reject uncompressing directories

This commit is contained in:
Emil J. Tywoniak 2025-05-09 21:23:34 +02:00
parent b05c0c70af
commit 2e9a194ce9

View file

@ -102,6 +102,8 @@ gzip_istream::ibuf::~ibuf() {
// returns the original ifstream, rewound to the start.
// Never returns nullptr or failed state istream*
std::istream* uncompressed(const std::string filename, std::ios_base::openmode mode) {
if (!check_file_exists(filename))
log_cmd_error("File `%s' not found or is a directory\n", filename.c_str());
std::ifstream* f = new std::ifstream();
f->open(filename, mode);
if (f->fail())