Conversation
SpecLad
reviewed
Dec 11, 2025
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10102 +/- ##
===========================================
+ Coverage 75.93% 82.67% +6.73%
===========================================
Files 428 485 +57
Lines 46337 49504 +3167
Branches 4143 4162 +19
===========================================
+ Hits 35186 40927 +5741
+ Misses 11151 8577 -2574
🚀 New features to boost your workflow:
|
SpecLad
reviewed
Dec 15, 2025
changelog.d/20251215_170405_grigorio714_chunk_start_to_chunk_end.md
Outdated
Show resolved
Hide resolved
SpecLad
reviewed
Dec 15, 2025
|
Merged
zoe-seo
pushed a commit
to AutoLabeling-dotdot/AutoLabelingTool
that referenced
this pull request
Jan 22, 2026
**Problem:** The TUS upload implementation incorrectly validated chunk boundaries by checking only the **start offset** (`chunk.offset`) instead of the **end offset** (`chunk.offset + chunk.size`). This allowed clients to upload chunks that exceed the declared file size, potentially causing: - Buffer overflows - Data corruption - Files larger than expected - Violation of TUS protocol specification **Example:** - File size: 10,000 bytes - Current offset: 9,000 bytes - Chunk size: 2,000 bytes - Old code: checks `9,000 > 10,000` -> passes (incorrect) - New code: checks `11,000 > 10,000` -> fails with 413 (correct) **Solution:** 1. Added `end_offset` property to `TusChunk` class that calculates `offset + size` 2. Changed validation in `mixins.py` from `chunk.offset > file_size` to `chunk.end_offset > file_size` 3. Added comprehensive test `test_cannot_upload_chunk_exceeding_file_size` to verify the fix This ensures the server correctly rejects chunks whose end position would exceed the declared file size, preventing data corruption and enforcing TUS protocol compliance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Motivation and context
Problem:
The TUS upload implementation incorrectly validated chunk boundaries by checking only the start offset (
chunk.offset) instead of the end offset (chunk.offset + chunk.size). This allowed clients to upload chunks that exceed the declared file size, potentially causing:Example:
9,000 > 10,000-> passes (incorrect)11,000 > 10,000-> fails with 413 (correct)Solution:
end_offsetproperty toTusChunkclass that calculatesoffset + sizemixins.pyfromchunk.offset > file_sizetochunk.end_offset > file_sizetest_cannot_upload_chunk_exceeding_file_sizeto verify the fixThis ensures the server correctly rejects chunks whose end position would exceed the declared file size, preventing data corruption and enforcing TUS protocol compliance.
How has this been tested?
New test added:
test_cannot_upload_chunk_exceeding_file_size- Verifies that:offset=1000andsize=(file_size - 500)is rejectedend_offset = 1000 + (file_size - 500) > file_sizeis properly validatedChecklist
developbranchI have created a changelog fragmentI have updated the documentation accordinglyI have linked related issuesLicense
Feel free to contact the maintainers if that's a concern.