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

Fix a crash when accessing a corrupted classic file. #2732

Merged
merged 3 commits into from
Aug 9, 2023

Conversation

DennisHeimbigner
Copy link
Collaborator

@DennisHeimbigner DennisHeimbigner commented Aug 8, 2023

A corrupted classic file is causing the library to crash. Fix so that it returns NC_ENOTNC instead.

re: Issue Unidata#2731

A corrupted classic file is causing the library to crash.
Fix so that it returns NC_ENOTNC instead.
libsrc/posixio.c Outdated
assert(extent != 0);
assert(extent < X_INT_MAX); /* sanity check */
assert(offset >= 0); /* sanity check */
if(extent == 0 || extent >= X_INT_MAX || offset >= 0) /* sanity check */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by-review:

It should be offset < 0 right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct; just pushed a fix.

@WardF WardF merged commit c374536 into Unidata:main Aug 9, 2023
97 checks passed
@DennisHeimbigner DennisHeimbigner deleted the corrupt.dmh branch September 27, 2023 19:00
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.

nc_open "Abort" crash on a corrupted netCDF classic file
3 participants