Stebalien / tempfile

Temporary file library for rust
http://stebalien.com/projects/tempfile-rs
Apache License 2.0
1.2k stars 120 forks source link

Fix integer overflows and truncation #278

Closed stoeckmann closed 9 months ago

stoeckmann commented 9 months ago

Make sure that calculations do not overflow. Also do not truncate u64 to usize on 32 bit systems.

I have added tests to showcase the issues.

stoeckmann commented 9 months ago

Did you run into any actual issues?

No, it's been about making the API robust against such values.

I've split the commits into two, since I assumed that it might be argued this way. So... Fell free to cherry pick, otherwise I can drop the second one.

Stebalien commented 9 months ago

Published as v3.10.1.

stoeckmann commented 9 months ago

Thanks for the fixes and for working with me to find a good solution.

Thank you as well for the feedback and especially for maintaining the crate!