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

Add check for stored sizes in parsing #103

Merged
merged 9 commits into from
Jun 20, 2024

Conversation

sdierg
Copy link
Contributor

@sdierg sdierg commented Jun 17, 2024

Description

Current Situation/Motivation:
When checking an image with subblocks with "StoredSize=37" for "H" dimension, CziCheck did pass without error.
As such documents are malformed, parsing should not succeed, at least not for strict parsing.

Change: libCzi checks the stored/pixel size when strict parsing is enabled.

Benefit:
Strict parsing can be enabled in CziCheck, then on parsing an exception is thrown and corrupted/illegal files will not pass CziCheck silently.

Fixes #102

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

New functionality checked with CziCmd and a file with size=37 in H-dimension.

Checklist:

  • I followed the Contributing Guidelines.
  • I did a self-review.
  • I commented my code, particularly in hard-to-understand areas.
  • I updated the documentation.
  • I updated the version of libCZI following Versioning of libCZI depending on the type of change
    • Bug fix -> PATCH
    • New feature -> MINOR
    • Breaking change -> MAJOR
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Src/libCZI/CziParse.h Outdated Show resolved Hide resolved
Src/libCZI/CziParse.h Outdated Show resolved Hide resolved
Src/libCZI/CziParse.cpp Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jun 17, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 66.01%. Comparing base (067f3b0) to head (fc82c22).

Files Patch % Lines
Src/libCZI/CziParse.cpp 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #103      +/-   ##
==========================================
+ Coverage   65.99%   66.01%   +0.02%     
==========================================
  Files          85       85              
  Lines       10653    10664      +11     
==========================================
+ Hits         7030     7040      +10     
- Misses       3623     3624       +1     
Flag Coverage Δ
windows-latest 66.01% <91.66%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@ptahmose
Copy link
Contributor

What's still missing (aside from functional aspects):

@ptahmose ptahmose added the cla Contributor License Agreement sent to Admin label Jun 18, 2024
Src/libCZI/CziParse.cpp Outdated Show resolved Hide resolved
@sdierg sdierg self-assigned this Jun 20, 2024
@sdierg sdierg marked this pull request as ready for review June 20, 2024 10:09
Copy link
Contributor

@ptahmose ptahmose left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@sdierg sdierg merged commit dedfa6e into main Jun 20, 2024
15 checks passed
@ptahmose ptahmose deleted the add_check_for_stored_sizes_in_parsing branch June 21, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla Contributor License Agreement sent to Admin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check stored/pixel size for strict parsing
2 participants