ttcn3: fix uncaught exception in SS

fix accessing child element in parsed Json without checking
its existence.
master
Andre Puschmann 4 years ago
parent 8df388ba3e
commit 3088cdbb0f

@ -104,15 +104,20 @@ private:
++itr) {
assert(itr->HasMember("PduSduList"));
assert((*itr)["PduSduList"].IsObject());
assert((*itr)["PduSduList"].HasMember("PdcpSdu"));
assert((*itr)["PduSduList"]["PdcpSdu"].IsArray());
const Value& sdulist = (*itr)["PduSduList"]["PdcpSdu"];
for (Value::ConstValueIterator sdu_itr = sdulist.Begin(); sdu_itr != sdulist.End(); ++sdu_itr) {
assert(sdu_itr->IsString());
string sdustr = sdu_itr->GetString();
asn1::dyn_octstring octstr(sdustr.size());
octstr.from_string(sdustr);
handle_sdu(document, lcid, octstr.data(), octstr.size(), ttcn3_helpers::get_follow_on_flag(document));
if ((*itr)["PduSduList"].HasMember("PdcpSdu")) {
assert((*itr)["PduSduList"]["PdcpSdu"].IsArray());
const Value& sdulist = (*itr)["PduSduList"]["PdcpSdu"];
for (Value::ConstValueIterator sdu_itr = sdulist.Begin(); sdu_itr != sdulist.End(); ++sdu_itr) {
assert(sdu_itr->IsString());
string sdustr = sdu_itr->GetString();
asn1::dyn_octstring octstr(sdustr.size());
octstr.from_string(sdustr);
handle_sdu(document, lcid, octstr.data(), octstr.size(), ttcn3_helpers::get_follow_on_flag(document));
}
} else if ((*itr)["PduSduList"].HasMember("MacPdu")) {
log->warning("Not handling MacPdu type.");
} else {
log->warning("Not handling this PduSdu type.\n");
}
}

@ -374,11 +374,13 @@ private:
const Value& config = (*itr)["Config"];
if (config.HasMember("AddOrReconfigure")) {
const Value& aor = config["AddOrReconfigure"];
uint32_t lcid = aor["LogicalChannelId"].GetInt();
if (lcid > 0) {
pdcp_config_t pdcp_cfg = make_drb_pdcp_config_t(static_cast<uint8_t>(lcid), false);
syssim->add_drb(
ttcn3_helpers::get_timing_info(document), ttcn3_helpers::get_cell_name(document), lcid, pdcp_cfg);
if (aor.HasMember("LogicalChannelId")) {
uint32_t lcid = aor["LogicalChannelId"].GetInt();
if (lcid > 0) {
pdcp_config_t pdcp_cfg = make_drb_pdcp_config_t(static_cast<uint8_t>(lcid), false);
syssim->add_drb(
ttcn3_helpers::get_timing_info(document), ttcn3_helpers::get_cell_name(document), lcid, pdcp_cfg);
}
}
} else if (config.HasMember("Release")) {
uint32_t lcid = id["Drb"].GetInt() + 2;

Loading…
Cancel
Save