作者:期待眺望未来_974 | 来源:互联网 | 2023-08-23 08:08
hi,
while i was debugging my app, i've got this exception:
1 2 3 4 5
| cpp
Exception thrown: read access violation.
std::_Vector_alloc<:_vec_base_types>,std::allocator >,std::allocator<:basic_string>,std::allocator > > > >::_Myfirst(...) returned 0xCCCCCCD0.
|
If there is a handler for this exception, the program may be safely continued.
first, what i'm intending to do:
i'm writing a wrapper for wit.ai using libcurl and jsoncpp for my needs
this is my code where the crash happens:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| cpp
class Responce
{
protected:
Json::Value responce;
public:
Responce(std::string r)
{
Json::CharReaderBuilder builder;
std::stringstream stream;
stream.str(r);
std::string errors;
if(!Json::parseFromStream(builder, stream, &responce, &errors))
{
throw std::invalid_argument(errors);
}
else
{
if(responce.isMember("error")||responce.isMember("code")||responce["error"].isString())
{
if(responce["code"].isInt()||responce["code"].isUInt())
{
throw WitException(responce["error"].asString(), responce["code"].asInt());
}
else
{
throw WitException(responce["error"].asString(), 0);
}
}
}
}
}; |
when i comment the parsing stuff, the exception goes away (meaning that the problem is there)
该提问来源于开源项目:open-source-parsers/jsoncpp
one of the problem is my witpp::Context
when i commented out my s+="&cOntext="+(std::string)*context;
that error got fixed
now, another assertion failure in Json::Value
it seems that i have issues with Json::Value:
here is the call stack:
1 2 3 4 5 6 7 8
| ucrtbased.dll!00e99510() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for ucrtbased.dll]
ucrtbased.dll!00e996b1() Unknown
ucrtbased.dll!00eb40da() Unknown
ucrtbased.dll!00eb88ad() Unknown
ucrtbased.dll!00eb8549() Unknown
ucrtbased.dll!00eb6bdd() Unknown
ucrtbased.dll!00eb8d7a() Unknown |
wit.exe!Json::Value::dupPayload(const Json::Value & other) Line 3507 C++
wit.exe!Json::Value::Value(const Json::Value & other) Line 2931 C++
wit.exe!witpp::Responce::Responce(const witpp::Responce & __that) C++
wit.exe!witpp::MessageResponce::MessageResponce(const witpp::MessageResponce & __that) C++
wit.exe!main() Line 24 C++
wit.exe!invoke_main() Line 64 C++
wit.exe!__scrt_common_main_seh() Line 253 C++
wit.exe!__scrt_common_main() Line 296 C++
wit.exe!mainCRTStartup() Line 17 C++
kernel32.dll!75d662c4() Unknown
ntdll.dll!77ae0f79() Unknown
ntdll.dll!77ae0f44() Unknown