You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that each implementation of FilesystemPath::isFile returns !isDirectory. The isDirectory functions appear to check whether the path is valid or exists and returns false if it is not. This causes instances of isFile to return true when the path may not even exist.
In the docstring it states "The path doesn't have to be loaded." Does this imply that it may not exist? If this is the case there may be instances where a non-existent file is not caught.
The text was updated successfully, but these errors were encountered:
astrelsky
pushed a commit
to astrelsky/retdec
that referenced
this issue
Feb 5, 2019
Thank you for the bug report. I see that you also fixed it yourself, so also thank you for that! Unfortunately it's in your PR about bin2pat, so I cannot merge it separately.
Just a note about your fix. I would prefer if FilesystemPathImplWindows::isFile() and FilesystemPathImplUnix::isFile() would actually check if the path is file as they should, because I think that your fix is workaround for broken isFile() implementation but it doesn't fix the root cause and that is how isFile() is implemented.
I suggest that FilesystemPathImplWindows::isFile() should check if FILE_ATTRIBUTE_DIRECTORY bit is not set and FilesystemPathImplUnix::isFile() should check for S_ISREG(st.st_mode).
astrelsky
pushed a commit
to astrelsky/retdec
that referenced
this issue
Feb 5, 2019
* Fixed FilesystemPath::isFile return value.
Resolves#490
* Refactoring of FilesystemPathImplWindows
Instances of reinterpret_cast<HANDLE>(-1) in
FilesystemPathImplWindows have been replaced with
INVALID_HANDLE_VALUE for readability. GetFileAttributes was
utilized in place of FindFirstFile to check for file existance
and file attributes.
I noticed that each implementation of FilesystemPath::isFile returns !isDirectory. The isDirectory functions appear to check whether the path is valid or exists and returns false if it is not. This causes instances of isFile to return true when the path may not even exist.
In the docstring it states "The path doesn't have to be loaded." Does this imply that it may not exist? If this is the case there may be instances where a non-existent file is not caught.
The text was updated successfully, but these errors were encountered: