IXCobraConnection / pdu handlers can crash if they receive json data which is not an object

This commit is contained in:
Benjamin Sergeant 2019-09-05 20:24:42 -07:00
parent 3e3f7171fc
commit 5e94791b13
2 changed files with 15 additions and 0 deletions

View File

@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.
## [6.0.1] - 2019-09-05
- IXCobraConnection / pdu handlers can crash if they receive json data which is not an object
## [6.0.0] - 2019-09-04
- all client autobahn test should pass !

View File

@ -13,6 +13,7 @@
#include <cmath>
#include <cassert>
#include <cstring>
#include <iostream>
namespace ix
@ -300,6 +301,8 @@ namespace ix
//
bool CobraConnection::handleHandshakeResponse(const Json::Value& pdu)
{
if (!pdu.isObject()) return false;
if (!pdu.isMember("body")) return false;
Json::Value body = pdu["body"];
@ -349,6 +352,8 @@ namespace ix
bool CobraConnection::handleSubscriptionResponse(const Json::Value& pdu)
{
if (!pdu.isObject()) return false;
if (!pdu.isMember("body")) return false;
Json::Value body = pdu["body"];
@ -365,6 +370,8 @@ namespace ix
bool CobraConnection::handleUnsubscriptionResponse(const Json::Value& pdu)
{
if (!pdu.isObject()) return false;
if (!pdu.isMember("body")) return false;
Json::Value body = pdu["body"];
@ -381,6 +388,8 @@ namespace ix
bool CobraConnection::handleSubscriptionData(const Json::Value& pdu)
{
if (!pdu.isObject()) return false;
if (!pdu.isMember("body")) return false;
Json::Value body = pdu["body"];
@ -407,6 +416,8 @@ namespace ix
bool CobraConnection::handlePublishResponse(const Json::Value& pdu)
{
if (!pdu.isObject()) return false;
if (!pdu.isMember("id")) return false;
Json::Value id = pdu["id"];