jsoncpp释放字符串值崩溃

时间:2017-12-31 03:26:32

标签: json windows jsoncpp

我正在尝试在Windows上格式化json值,其中包括:

json::value root;
root["uid"] = "uid";

但是,当它试图释放时,应用程序崩溃了。

[STACK]

0:019:x86> kb
 # ChildEBP RetAddr  Args to Child              
WARNING: Stack unwind information not available. Following frames may be wrong.
00 0555f5f8 77248d48 01110000 00000002 0555f638 ntdll_77160000!RtlpNtSetValueKey+0x1b7
01 0555f608 772495f9 0d84b688 011b61a0 01110000 ntdll_77160000!RtlpNtSetValueKey+0x2d58
02 0555f638 771e6168 011b61a0 00000000 00000000 ntdll_77160000!RtlpNtSetValueKey+0x3609
03 0555f694 7347dbeb 01110000 00000000 011b61a8 ntdll_77160000!LdrGetDllPath+0x6d58
04 0555f6a8 7344fe7e 011b61a8 9ab8b012 04f246f0 modwebshell!_free_base+0x1c [d:\th\minkernel\crts\ucrt\src\appcrt\heap\free_base.cpp @ 107]
05 (Inline) -------- -------- -------- -------- modwebshell!Json::releaseStringValue+0x6 [\json\json_value.cpp @ 174]
06 (Inline) -------- -------- -------- -------- modwebshell!Json::Value::CZString::{dtor}+0x16 [\json\json_value.cpp @ 287]
07 0555f7b4 734698c0 734a5018 734a501b 04ee8cc0 modwebshell!Json::Value::resolveReference+0x1ae [json\json_value.cpp @ 1091]
08 (Inline) -------- -------- -------- -------- modwebshell!Json::Value::operator[]+0x19 json\json_value.cpp @ 1126]
09 0555f870 73465925 04ec03a8 9ab8bf46 7450a320 modwebshell!WebshellManager::ReportAlarm+0x310 

== [发布什么:]

0:019:x86> dv
          block = 0x011b61a8
0:019:x86> dt block
Local var @ 0x555f6b0 Type void*
0x011b61a8 
Void

== 代码的一部分在这里:

// @param key is not null-terminated.
Value& Value::resolveReference(char const* key, char const* cend)
{
  JSON_ASSERT_MESSAGE(
      type_ == nullValue || type_ == objectValue,
      "in Json::Value::resolveReference(key, end): requires objectValue");
  if (type_ == nullValue)
    *this = Value(objectValue);
  CZString actualKey(
      key, static_cast<unsigned>(cend-key), CZString::duplicateOnCopy);
  ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
  if (it != value_.map_->end() && (*it).first == actualKey)
    return (*it).second;

  ObjectValues::value_type defaultValue(actualKey, nullSingleton());
  it = value_.map_->insert(it, defaultValue);
  Value& value = (*it).second;
  return value;
}
任何人都可以给出一些暗示吗?谢谢!

1 个答案:

答案 0 :(得分:0)

嗯,经过一番调查,这是因为我从其他地方打破了堆。