noloader/cryptopp-pem

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

rbenet-lbo opened this issue · 1 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?