-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
File::set_len uses an unsafe cast on Unix #63326
Copy link
Copy link
Closed
bytecodealliance/wasmtime
#2164Labels
C-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Precisely,
size as off64_t. The conversion occurs hereOn my system
off64_tisi64. This means that the number will overflow if larger thani64::max_value()and become negative. In such case,ftruncatewill return anEINVAL: (fromman ftruncate:Should we manually return an error should an overflow occur or is the
EINVALreturned byftruncatethe intended behavior? I would return anio::ErrorKind::InvalidInputwith the payload indicating that an overflow occured (or even justTryFromIntError(())whichtry_intoreturns)This issue was noticed while discussing CraneStation/wasi-common#47.
cc @alexcrichton
I will implement the fix once we've decided what kind of behavior we want.