Invalid casts in instance.c
Categories
(NSS :: Libraries, defect, P3)
Tracking
(Not tracked)
People
(Reporter: mt, Unassigned)
References
Details
(Keywords: good-first-bug)
Attachments
(2 files, 1 obsolete file)
cl on Windows complains of an invalid cast in instance.c:
...\nss\lib\ckfw\instance.c(550): warning C4312: 'type cast': conversion from 'CK_SESSION_HANDLE' to 'const void *' of greater size
This probably benign, but we should build a function that performs this conversion AND statically asserts that the conversion is lossless, i.e.:
PR_STATIC_ASSERT(sizeof(CK_SESSION_HANDLE) <= sizeof(void*));
That function might need to be structured so that it suppresses the warning, but we can probably use uintptr_t as an intermediate value.
Updated•5 years ago
|
Hello, although I am new to this community I would love to attempt contributing to this bug. Thanks
Reporter | ||
Comment 3•5 years ago
|
||
If you can make some changes to instance.c that makes the warnings go away, that would be greatly appreciated. I would start with reproducing the problem on a Windows build. Then take a look at the code to see what might be changed to fix it.
Sorry, I realized my build is done in a linux environment. Thanks for your time
![]() |
||
Comment 6•3 years ago
|
||
Please see the contribution documentation at https://firefox-source-docs.mozilla.org/.
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•2 years ago
|
Add the CKSessionHandleToVoidPtr function, which performs the
conversion from CK_SESSION_HANDLE to const void* using uintptr_t
as an intermediate value. This function is then used in the
nssCKFWHash_Add function call to avoid the warning and ensure
the conversion is lossless.
Updated•1 year ago
|
Updated•1 year ago
|
Comment 10•1 year ago
|
||
The patch for this bug should be for the NSS repo right? The code lives there and then Firefox vendors it into mozilla-central when NSS releases a new version.
Updated•11 months ago
|
Comment 12•11 months ago
|
||
Comment 13•11 months ago
|
||
Description
•