Microsoft C++ exception: CryptoPP::InvalidCiphertext at memory location.....Answered

We've been using LimeLM static libraries successfully in a Windows application for 5+ years. We're suddenly getting this exception error. We've recompiled the application in VS2022 with the latest static libraries and this makes no difference.

The final call in the call stack that leads to the exception is:
    ourDLL.dll!CryptoPP::StreamTransformationFilter::LastPut(unsigned char const *,unsigned __int64)    Unknown

Any pointers for resolution?
 

Answer

Any pointers for resolution?

Use the dynamic libraries. It's too complicated to use static libraries correctly (it requires many hours of analysis, planning, etc., which isn't a good use of anyone's time.

The dynamic libraries will just work no matter how you compile your app.

We’ve been using the static libraries without issue since 2016! It’s not friendly to distribute additional DLLs with our app. 

Static libs are very hard to use correctly. If you change one small thing a perfectly working build can turn into a completely broken build.

And a completely broken build is best case.

Worst case is a subtly broken build (bad output without crashing your app).

So, just use the dynamic libraries and not worry about silent corruption bugs.