Skip to content

Validate ImageFileReader frame indices - #434

Closed
yinkev wants to merge 1 commit into
ImagingDataCommons:masterfrom
yinkev:fix/image-reader-frame-bounds
Closed

yinkev wants to merge 1 commit into
ImagingDataCommons:masterfrom
yinkev:fix/image-reader-frame-bounds

Conversation

@yinkev

@yinkev yinkev commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reject negative frame indices and indices equal to NumberOfFrames
  • validate before indexing the offset table or seeking into pixel data
  • document the ValueError contract on raw and decoded frame access

Root cause

The previous condition used index > number_of_frames. It therefore allowed Python negative indexing and missed the first invalid upper-bound value, index == number_of_frames.

Validation

  • regression fails on upstream/master
  • focused regression: 1 passed
  • full tests/test_io.py: 111 passed, 9 skipped
  • Flake8 on touched files
  • git diff --check

Signed-off-by: kyinhub <kevinpyin@gmail.com>
@yinkev

yinkev commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Replaced by #444 to conform to this repository's documented contributor workflow and branch-naming convention. The replacement uses the same signed commit and identical code diff: #444

@yinkev yinkev closed this Jul 25, 2026
@yinkev
yinkev deleted the fix/image-reader-frame-bounds branch July 25, 2026 19:47
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.

1 participant