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

Improve error handling in LibTiffDecoder #4210

Merged
merged 8 commits into from
Sep 20, 2022

Conversation

szkarpinski
Copy link
Collaborator

Category:

Bug fix (non-breaking change which fixes an issue)

Description:

While testing LibTiffDecoder, I've identified two major problems with error handling there:

  • Corrupted (or exotic, unsupported) files will cause an exception, which would kill the pipeline. In this PR I add a bulk catch to gracefully handle those and allow for a fallback instead of killing the pipeline
  • Not enough checks were made at the beginning and as a result TIFFs that we couldn't decode correctly (planar or with non-standard photometric interpretation) were not rejected. In this PR I add checks for those

Additional information:

Affected modules and functionalities:

LibTiffDecoder

Key points relevant for the review:

Tests:

I added an extra test with an incomplete input, which should cause InputStream to throw an exception.

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: DALI-2981

Signed-off-by: Szymon Karpiński <skarpinski@nvidia.com>
Comment on lines 259 to 260
DecodeResult LibTiffDecoderInstance::Decode(SampleView<CPUBackend> out, ImageSource *in,
DecodeParams opts, const ROI &requested_roi) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is already out of date due to API changes. Also, please implement DecodeTaskImpl nistead of DecodeImpl, as it is required by ScheduleDecode.

jantonguirao and others added 3 commits September 19, 2022 15:26
Signed-off-by: Joaquin Anton <janton@nvidia.com>
Signed-off-by: Szymon Karpiński <skarpinski@nvidia.com>
Signed-off-by: Joaquin Anton <janton@nvidia.com>
Signed-off-by: Joaquin Anton <janton@nvidia.com>
@@ -114,10 +114,12 @@ struct TiffInfo {
uint16_t bit_depth;
uint16_t orientation;
uint16_t compression;
uint16_t photometric;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: the name sounds as if it's a boolean predicate - I'd expect a noun.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

Signed-off-by: Joaquin Anton <janton@nvidia.com>
Signed-off-by: Joaquin Anton <janton@nvidia.com>
Signed-off-by: Joaquin Anton <janton@nvidia.com>
@jantonguirao
Copy link
Contributor

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [5958401]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [5958401]: BUILD PASSED

@jantonguirao jantonguirao merged commit 5b0587e into NVIDIA:main Sep 20, 2022
staniewzki pushed a commit to staniewzki/DALI that referenced this pull request Sep 21, 2022
While testing LibTiffDecoder, I've identified two major problems with error handling there:

Corrupted (or exotic, unsupported) files will cause an exception, which would kill the pipeline. In this PR I add a bulk catch to gracefully handle those and allow for a fallback instead of killing the pipeline
Not enough checks were made at the beginning and as a result TIFFs that we couldn't decode correctly (planar or with non-standard photometric interpretation) were not rejected. In this PR I add checks for those

Signed-off-by: Szymon Karpiński <skarpinski@nvidia.com>
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

5 participants