Stebalien / tempfile

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

Fix integer overflows and truncation #278

Closed stoeckmann closed 8 months ago

stoeckmann commented 8 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 8 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 8 months ago

Published as v3.10.1.

stoeckmann commented 8 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!