Hi, Did you build it from the official tarbal archive?
Have you compiled the example without any source code modification? What is your compiler, librarian and linker settings?Share your "Command line" for the library and the application if you added a VS project.
Can you share the content of 'base64' and 'base64_len' parameters, when MHD_base64_to_bin_n() is called and then aborted with run-time check?
Probably VS compiler requires an extra casting, while in practice the code has enough castings already.
-- Evgeny On 11.09.2023 12:14, luozhaotian wrote:
When test https://www.gnu.org/software/libmicrohttpd/tutorial.html <https://www.gnu.org/software/libmicrohttpd/tutorial.html> chapter 5 Supporting basic authentication(libmicrohttpd-0.9.77/doc/examples/basicauthentication.cpp), i encounter this error: Run-Time Check Failure #1 - A cast to a smaller data type has caused a loss of data. If this was intentional, you should mask the source of the cast with the appropriate bitmask.The call stack:>Hello.exe!MHD_base64_to_bin_n(const char * base64, unsigned __int64 base64_len, void * bin, unsigned __int64 bin_size) line 1422 Hello.exe!MHD_basic_auth_get_username_password(MHD_Connection * connection, char * * password) line 95 Hello.exe!answer_to_connection(void * cls, MHD_Connection * connection, const char * url, const char * method, const char * version, const char * upload_data, unsigned __int64 * upload_data_size, void * * con_cls) line 46Hello.exe!call_connection_handler(MHD_Connection * connection) line 3070 ...... MHD_basic_auth_get_username_password I use Visual Studio 2022 Microsoft Visual Studio Community 2022 (64 位) - Current Version 17.5.3I use Debug_x64 , and static link to 0.9.77\x86_64\VS2022\Debug-static\libmicrohttpd_d.libBut use dll is ok.
OpenPGP_0x460A317C3326D2AE.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature