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

backport: Allow reading not-quite null-terminated strings. #1059

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

1uc
Copy link
Collaborator

@1uc 1uc commented Nov 28, 2024

For fixed-length strings that have a padding mode that suggests they're null-terminated are in fact not required to be null-terminated, we (silently) fail to read the last character. Since, HDF5 will create such string, h5dump will display the file and h5py will read the string; we opted to allow it and also read the string into and std::string (which is variable length and already not guaranteed to have the same length as the fixed length string).

HighFive will continue to not allow writing null-terminated strings that aren't via write.

Backports: #1056

1uc added 2 commits November 28, 2024 13:40
For fixed-length strings that have a padding mode that suggests they're
null-terminated are in fact not required to be null-terminated, we (silently)
fail to read the last character. Since, HDF5 will create such string, h5dump
will display the file and h5py will read the string; we opted to allow it and
also read the string into and `std::string` (which is variable length and already
not guaranteed to have the same length as the fixed length string).

HighFive will continue to not allow writing null-terminated strings that aren't
via `write`.

Backports: (#1056)
@1uc 1uc force-pushed the 1uc/backport-not-so-null branch from 1fb82fd to 8fc0860 Compare November 28, 2024 13:02
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.39%. Comparing base (0cd16e0) to head (3d94555).
Report is 1 commits behind head on v2.x.

Additional details and impacted files
@@            Coverage Diff             @@
##             v2.x    #1059      +/-   ##
==========================================
+ Coverage   86.35%   86.39%   +0.04%     
==========================================
  Files          90       90              
  Lines        5952     5970      +18     
==========================================
+ Hits         5140     5158      +18     
  Misses        812      812              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@1uc 1uc marked this pull request as ready for review November 29, 2024 13:38
@1uc 1uc merged commit e2f66a4 into v2.x Dec 2, 2024
34 checks passed
@1uc 1uc deleted the 1uc/backport-not-so-null branch December 2, 2024 09:51
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