[PATCH] rsaenh: do not use stack variables out of frame (Coverity)

Jacek Caban jacek at codeweavers.com
Mon Jul 17 11:23:31 CDT 2017


On 15.07.2017 10:07, Marcus Meissner wrote:
> 1414721 Pointer to local outside scope
>
> These harmless looking assignments are of the form:
>
> 	algid = BCRYPT_SHA512_ALGORITHM;
>
> with ../../include/bcrypt.h:#define BCRYPT_SHA512_ALGORITHM     (const WCHAR []){'S','H','A','5','1','2',0}
> this is
> 	algid = temporary allocated stack variable
>
> The stack array however goes invalid as soon as it leaves the "switch" case.
>
> Use a stack temporary array to avoid this confusion.

This actually shows a huge problem with using (const WCHAR []){ .... }
casts in Wine. In this case it's meant to replace L"..." for wide
strings and that in mind, affected code is perfectly fine. It's
definition in header that is not compatible. Sadly, I don't see a good
solution for that. We could just not not use such casts and use static
const variables in headers like we do in many other cases, but that has
its own problems.

Jacek



More information about the wine-devel mailing list