Skip to content

std: reject Windows File::truncate sizes that exceed i64::MAX#592

Open
SebTardif wants to merge 1 commit into
mainfrom
fix-r74-windows-truncate-overflow
Open

std: reject Windows File::truncate sizes that exceed i64::MAX#592
SebTardif wants to merge 1 commit into
mainfrom
fix-r74-windows-truncate-overflow

Conversation

@SebTardif

Copy link
Copy Markdown
Owner

Summary

Use try_into::<i64>() for FILE_END_OF_FILE_INFO::EndOfFile instead of size as i64, returning InvalidInput on overflow (Unix ftruncate already does this).

Closes #589

Related: #449 / #453 (prior attempt on older branch)

Origin

Windows FS implementation used a direct cast; Unix path validates via try_into.

Test plan

  • Mirrors Unix truncate error contract
  • Code review

size as i64 silently wraps huge values to negative EOF offsets. Match
Unix ftruncate and return InvalidInput instead.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
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.

Windows File::truncate silently wraps u64 > i64::MAX to negative EOF

1 participant