OSDN Git Service

GATT cache memory corruption fix
authorJakub Pawlowski <jpawlowski@google.com>
Tue, 5 Dec 2017 12:05:46 +0000 (04:05 -0800)
committerJakub Pawlowski <jpawlowski@google.com>
Thu, 7 Dec 2017 19:57:43 +0000 (11:57 -0800)
commit6918d40fd9ca8c58c115cf694f165413165e5758
treeb63aa72cd28405020f2ebfce766fdafa0cbe8d84
parent80c1e1c4949cdcbae8f58ce697f4cbf505f0642a
GATT cache memory corruption fix

When doing GATT discovery, we interleave adding elements to vector,
and storing pointers to them. This can cause memory corruption, because
vector can reallocate the memory when adding element, leaving the pointers
invalid. To fix that, never store pointers to mutable vector elements.

Bug: 70041392
Test: manual, connected to HID device
Change-Id: I6bb3fec61afa742f446b66e3291c5f326738ee17
bta/gatt/bta_gattc_act.cc
bta/gatt/bta_gattc_api.cc
bta/gatt/bta_gattc_cache.cc
bta/gatt/bta_gattc_int.h
bta/hh/bta_hh_le.cc
bta/include/bta_gatt_api.h