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 NikonPictureControl1Directory parsing #349

Merged
merged 6 commits into from
Nov 22, 2023

Conversation

drewnoakes
Copy link
Owner

Fix NikonPictureControl1Directory string reading. These fixed-width, null-terminated strings. We don't want those nulls in the string we return.

Also some minor tidying and adding a unit test.

@drewnoakes drewnoakes merged commit 13582c1 into master Nov 22, 2023
4 checks passed
@drewnoakes drewnoakes deleted the NikonPictureControl1Directory branch November 22, 2023 03:45
@gtiwari333
Copy link

@drewnoakes i am not sure how .NET works. but the code looks identical in Java and .NET.

Based on what i understand, this change will not read the value correctly. It will ONLY work if there are no null-terminated string in metadata.

        directory.Set(TagPictureControlVersion, reader.GetNullTerminatedStringValue(4));
        directory.Set(TagPictureControlName, reader.GetNullTerminatedStringValue(20));
        directory.Set(TagPictureControlBase, reader.GetNullTerminatedStringValue(20));

The issue is similar to what i described on drewnoakes/metadata-extractor#636 (comment).

In order to fix it, we need to either check the length of returned string and move the cursor after each read. Or, use a code similar to getNullTerminatedStringAndSkipToNextPosition.

@drewnoakes
Copy link
Owner Author

You're right, thanks. Fixed in #350 specifically e7cbf06 and bff31ad. I'll review the Java version, run the regression tests and get a fix up and another release out.

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.

None yet

2 participants