mirror of https://gitee.com/bigwinds/arangodb
Fixed error where a nullptr was dereferenced without any checks
This commit is contained in:
parent
09c9bdcd23
commit
bc1b69af70
|
@ -325,8 +325,8 @@ arangodb::basics::Json RestCursorHandler::buildExtra(
|
|||
arangodb::aql::QueryResult& queryResult) const {
|
||||
// build "extra" attribute
|
||||
arangodb::basics::Json extra(arangodb::basics::Json::Object);
|
||||
if (queryResult.stats != nullptr) {
|
||||
VPackSlice stats = queryResult.stats->slice();
|
||||
|
||||
if (!stats.isNone()) {
|
||||
extra.set("stats",
|
||||
arangodb::basics::Json(
|
||||
|
@ -334,6 +334,7 @@ arangodb::basics::Json RestCursorHandler::buildExtra(
|
|||
arangodb::basics::VelocyPackHelper::velocyPackToJson(stats),
|
||||
arangodb::basics::Json::AUTOFREE));
|
||||
}
|
||||
}
|
||||
if (queryResult.profile != nullptr) {
|
||||
extra.set("profile",
|
||||
arangodb::basics::Json(TRI_UNKNOWN_MEM_ZONE, queryResult.profile,
|
||||
|
|
|
@ -234,6 +234,7 @@ void RestSimpleHandler::removeByKeys(VPackSlice const& slice) {
|
|||
|
||||
size_t ignored = 0;
|
||||
size_t removed = 0;
|
||||
if (queryResult.stats != nullptr) {
|
||||
VPackSlice stats = queryResult.stats->slice();
|
||||
|
||||
if (!stats.isNone()) {
|
||||
|
@ -248,6 +249,7 @@ void RestSimpleHandler::removeByKeys(VPackSlice const& slice) {
|
|||
removed = found.getNumericValue<size_t>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VPackBuilder result;
|
||||
result.add(VPackValue(VPackValueType::Object));
|
||||
|
|
|
@ -2149,6 +2149,7 @@ static void JS_RemoveByKeys(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
size_t ignored = 0;
|
||||
size_t removed = 0;
|
||||
|
||||
if (queryResult.stats != nullptr) {
|
||||
VPackSlice stats = queryResult.stats->slice();
|
||||
|
||||
if (!stats.isNone()) {
|
||||
|
@ -2163,6 +2164,7 @@ static void JS_RemoveByKeys(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
removed = found.getNumericValue<size_t>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
v8::Handle<v8::Object> result = v8::Object::New(isolate);
|
||||
result->Set(TRI_V8_ASCII_STRING("removed"),
|
||||
|
|
|
@ -1163,12 +1163,16 @@ static void JS_ExplainAql(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
result->Set(TRI_V8_ASCII_STRING("warnings"),
|
||||
TRI_ObjectJson(isolate, queryResult.warnings));
|
||||
}
|
||||
if (queryResult.stats != nullptr) {
|
||||
VPackSlice stats = queryResult.stats->slice();
|
||||
if (stats.isNone()) {
|
||||
result->Set(TRI_V8_STRING("stats"), v8::Object::New(isolate));
|
||||
} else {
|
||||
result->Set(TRI_V8_STRING("stats"), TRI_VPackToV8(isolate, stats));
|
||||
}
|
||||
} else {
|
||||
result->Set(TRI_V8_STRING("stats"), v8::Object::New(isolate));
|
||||
}
|
||||
}
|
||||
|
||||
TRI_V8_RETURN(result);
|
||||
|
@ -1229,11 +1233,13 @@ static void JS_ExecuteAqlJson(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
result->ForceSet(TRI_V8_ASCII_STRING("json"),
|
||||
TRI_ObjectJson(isolate, queryResult.json));
|
||||
}
|
||||
if (queryResult.stats != nullptr) {
|
||||
VPackSlice stats = queryResult.stats->slice();
|
||||
if (!stats.isNone()) {
|
||||
result->ForceSet(TRI_V8_ASCII_STRING("stats"),
|
||||
TRI_VPackToV8(isolate, stats));
|
||||
}
|
||||
}
|
||||
if (queryResult.profile != nullptr) {
|
||||
result->ForceSet(TRI_V8_ASCII_STRING("profile"),
|
||||
TRI_ObjectJson(isolate, queryResult.profile));
|
||||
|
|
Loading…
Reference in New Issue