summaryrefslogtreecommitdiff
path: root/device/bluetooth
diff options
context:
space:
mode:
authormcchou <mcchou@chromium.org>2016-08-27 03:00:17 +0900
committerQijiang Fan <fqj@google.com>2020-06-05 04:01:49 +0900
commit103bbbdb5f54645f71f0b3da18d55d664d9a717e (patch)
tree75b3dcc59cd4d675f326e032dc59b3742fcc4be7 /device/bluetooth
parentf5c4f59d0b9398051b81b8334ee3085bd9849888 (diff)
downloadlibchrome-103bbbdb5f54645f71f0b3da18d55d664d9a717e.tar.gz
device/bluetooth: Fix copy constructor of BluetoothServiceAttributeValueBlueZ
The copy constructor was trying to call DeepCopy() against a nullptr. This adds a check if the type is NULLTYPE and return base::Value() if so. BUG=b:30963813 TEST=call the copy constructor with a NULLTYPE instance to see if it crashes Review-Url: https://codereview.chromium.org/2284713002 Cr-Commit-Position: refs/heads/master@{#414746} CrOS-Libchrome-Original-Commit: 4c369070c3e89056b3a90074315ac91b960862bf
Diffstat (limited to 'device/bluetooth')
-rw-r--r--device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.cc b/device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.cc
index c66b95332f..e9d61a8250 100644
--- a/device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.cc
@@ -33,6 +33,11 @@ BluetoothServiceAttributeValueBlueZ::BluetoothServiceAttributeValueBlueZ(
this->type_ = attribute.type_;
this->size_ = attribute.size_;
+ if (attribute.type_ == NULLTYPE) {
+ this->value_ = base::Value::CreateNullValue();
+ return;
+ }
+
if (attribute.type_ != SEQUENCE) {
this->value_ = base::WrapUnique(attribute.value_->DeepCopy());
return;