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

Avoid segfault if opening file failed #2427

Merged
merged 1 commit into from
Dec 19, 2023
Merged

Conversation

rouault
Copy link
Contributor

@rouault rouault commented Jun 23, 2022

It looks like on some platforms (e.g., MinGW) errno isn't set
when opening a file failed. That combination of a file id <0
and errno still 0 leads to a segmentation fault later on.

A possible solution to avoid that segfault is to set the status
to ENOENT if errno is unexpectedly 0.
That leads to the error ("No such file or directory") that was
reportedly emitted before version 4.9.0.

See also this report downstream: msys2/MINGW-packages#11918

It looks like on some platforms (e.g., MinGW) errno isn't set
when opening a file failed. That combination of a file id <0
and errno still 0 leads to a segmentation fault later on.

A possible solution to avoid that segfault is to set the status
to ENOENT if errno is unexpectedly 0.
That leads to the error ("No such file or directory") that was
reportedly emitted before version 4.9.0.

See also this report downstream: msys2/MINGW-packages#11918
@rouault rouault requested a review from WardF as a code owner June 23, 2022 19:12
@WardF WardF merged commit 4c28990 into Unidata:main Dec 19, 2023
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

Successfully merging this pull request may close these issues.

2 participants