-
Notifications
You must be signed in to change notification settings - Fork 168
Open
Description
Compiling the most recent version () on windows, I get the following warnings:
11>------ Build started: Project: picotlsvs, Configuration: Release x64 ------
...
9>Generating code
10>c:\users\huitema\github\picotls\lib\openssl.c(1099): warning C4311: 'type cast': pointer truncation from 'HANDLE' to 'int'
10>picotls.c
10>c:\users\huitema\github\picotls\t\picotls.c(1227): warning C4312: 'type cast': conversion from 'unsigned int' to 'void (__cdecl *)(ptls_async_job_t *)' of greater size
11>Generating code
The code implicitly assume that a "handle" (often a pointer) is the same bit size as an "int". For example in openssl.c we see:
int async_sign_ctx_get_fd(ptls_async_job_t *_self)
{
struct async_sign_ctx *self = (void *)_self;
OSSL_ASYNC_FD fds[1];
size_t numfds;
ASYNC_WAIT_CTX_get_all_fds(self->waitctx, NULL, &numfds);
assert(numfds == 1);
ASYNC_WAIT_CTX_get_all_fds(self->waitctx, fds, &numfds);
return (int)fds[0];
}
fds[0] is of type OSSL_ASYNC_FD, which on Windows is defined as HANDLE, which on 64 bits build of windows is a 64 bit number. The (int) cast will only retain the last 32 bits.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels