Skip to content

Commit

Permalink
Throw if open file with EXV_ENABLE_FILESYSTEM off
Browse files Browse the repository at this point in the history
If ImageFactory::createIo() is called with a file path and has been
built with EXV_ENABLE_FILESYSTEM off it returns a NULL pointer.
ImageFactory::open() then calls io->open() on this pointer, causing a
segfault. The documentation of ImageFactory::createIo does not say it
can return a NULL pointer. This commit makes it throw an exception
instead of returning a NULL pointer.

(cherry picked from commit b0f1c48)
  • Loading branch information
jim-easterbrook authored and mergify[bot] committed Aug 4, 2024
1 parent 2738730 commit 42b6b8c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ BasicIo::UniquePtr ImageFactory::createIo(const std::string& path, [[maybe_unuse

return std::make_unique<FileIo>(path);
#else
return nullptr;
throw Error(ErrorCode::kerFileOpenFailed, path, "", "file access disabled");
#endif
} // ImageFactory::createIo

Expand Down

0 comments on commit 42b6b8c

Please sign in to comment.