【问题标题】:jsoncpp release string value crashjsoncpp 释放字符串值崩溃
【发布时间】:2017-12-31 03:26:31
【问题描述】:

我正在尝试在 windows 上格式化一个 json 值:

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

但是,应用程序在尝试释放某事时崩溃。

[堆栈]

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;
}

谁能给点提示?谢谢!

【问题讨论】:

    标签: json windows jsoncpp


    【解决方案1】:

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

    【讨论】:

    • 我的情况一模一样。你是如何发现堆损坏/检索它试图释放的块上的任何有用信息的?是否与 JSON 解析或其他代码有关?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-27
    • 1970-01-01
    相关资源
    最近更新 更多