noloader / cryptopp-pem

PEM parsing of keys and parameters for Crypto++ project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

In PEM_read, use of std::min with incompatible types leads to compilation error

rbenet-lbo opened this issue · comments

In PEM_read, there is a call to std::min with types (lword and size_t). Depending on the platform those types are of different size and lead to a compilation error.

Following patch works for me:

     // If the IV size is wrong, SetKeyWithIV will throw an exception.
-    const size_t size = (std::min)(hex.MaxRetrievable(), static_cast<size_t>(vsize));
+    const size_t size = (std::min)(hex.MaxRetrievable(), static_cast<lword>(vsize));

Thanks @rbenet-lbo.

Yeah, that looks about right. Do you want to clear it, or do you want me to do it?