fix(hdr): Make the HDR reader tolerant to CR in the ASCII header#5261
Merged
Conversation
Carelessly written hdr/rgbe files, or correctly written ones that are checked out by git on windows if you're not careful, might use Windows CRLF line endings. Be silently tolerant of that. Assisted-by: Claude Code / opus-4.8 Signed-off-by: Larry Gritz <lg@larrygritz.com>
|
I don't know anything about this code, but should this fix live in Strutil::parse_line() (in src/libutil/strutil.cpp) which seems to assume LF terminated strings and could generally protect itself against CR/LF strings? |
Collaborator
Author
That's a really good question! I'm not really sure, to be honest. But I'll note the following:
I think these add up to my keeping the change I have as local to hdr as possible, and not wanting to mess with parse_line. But it was not an obvious answer, I really had to look at the code and think about it after pondering your question. |
|
Hopefully you didn't waste too much time on this... I agree with your analysis and "LGTM". |
lgritz
added a commit
that referenced
this pull request
Jul 1, 2026
Carelessly written hdr/rgbe files, or correctly written ones that are checked out by git on windows if you're not careful, might use Windows CRLF line endings. Be silently tolerant of that. Assisted-by: Claude Code / opus-4.8 Signed-off-by: Larry Gritz <lg@larrygritz.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Carelessly written hdr/rgbe files, or correctly written ones that are checked out by git on windows if you're not careful, might use Windows CRLF line endings. Be silently tolerant of that.
Assisted-by: Claude Code / opus-4.8