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

Use skipBytes(long) in places where integer overflow is possible #3529

Merged
merged 1 commit into from
Apr 2, 2020

Conversation

melissalinkert
Copy link
Member

Inspired by #3519, #3303, and #3157. This uses skipBytes(long) in more places where integer overflow seems plausible.

I would expect this to be safe for a patch release and have no impact on tests. I don't anticipate this will fix any outstanding issues, it's just an attempt at being more defensive.

@@ -231,7 +231,7 @@ else if (TypeUINT12) {
int thisSeries = getSeries();
for (int i=0; i<thisSeries; i++) {
setSeries(i);
in.skipBytes(getImageCount() * FormatTools.getPlaneSize(this));
in.skipBytes((long) getImageCount() * FormatTools.getPlaneSize(this));
Copy link
Member

@sbesson sbesson Mar 17, 2020

Choose a reason for hiding this comment

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

This seems to have impacted the non-regression tests for one li-flim sample file - see https://merge-ci.openmicroscopy.org/jenkins/job/BIOFORMATS-test-folder/52532/console. We might need to look at the data with or without this PR to establish whether the configuration needs to be regenerated or there is an issue with this change.

Copy link
Member Author

@melissalinkert melissalinkert Mar 17, 2020

Choose a reason for hiding this comment

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

Reasonably certain that the configuration needs to be updated, as proposed here: https://github.com/openmicroscopy/data_repo_config/pull/445

Note that without that change, the MD5s for series 0 and series 1 were the same, which points to this PR fixing a problem.

@sbesson sbesson self-requested a review March 17, 2020 16:54
Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

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

Went over all the modified readers and all proposed changes look sensible. Overall, I agree with this defensive approach both to prevent integer overflow as well as to fix real bugs as in the case of the li-flim sample. Happy for this PR to be merged for inclusion in the next patch release unless other @ome/formats members want to review it as well.

@dgault dgault added this to the 6.4.1 milestone Apr 2, 2020
@dgault dgault merged commit 292b42e into ome:develop Apr 2, 2020
@dgault dgault modified the milestones: 6.4.1, 6.5.0 Apr 29, 2020
@melissalinkert melissalinkert deleted the skipbytes-long branch May 20, 2021 22:28
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.

3 participants