summaryrefslogtreecommitdiff
path: root/libs/gui/DisplayEventDispatcher.cpp
diff options
context:
space:
mode:
author Marissa Wall <marissaw@google.com> 2019-11-21 15:23:23 -0800
committer Marissa Wall <marissaw@google.com> 2019-11-25 09:27:55 -0800
commit6eeaf925f30c271c7b04c3d7151d1f429e660002 (patch)
treebb879a0524a33102e42da75eadf34fcad56f31cb /libs/gui/DisplayEventDispatcher.cpp
parentda88195bf071f3241302f1d0176254d46080a57a (diff)
gralloc: libgralloctypes encode hidl_vec is invalid
hidl_vec's setToExternal takes data pointer. It doesn't copy the data. The data is only valid as long as the original data pointer is valid. libgralloctypes was calling setToExternal with a std::vector pointer. When the std::vector died, the data pointer was no longer point to valid memory. Encode functions were returning a hidl_vec whose data pointer was bad. It was missed during testing because the memory happened to still have the original data. This CL removes setToExternal. It is too costly to call resize() every time instead because it causes new memory to be allocated. Instead, this CL does a dry run to get the total size needed, resizes the buffer and then inserts the data. This CL also cleaned up code to make the dry run possible. Bug: 141632767 Test: libgralloctypes_fuzzer and VtsHalGraphicsMapperV4_0TargetTest Change-Id: I5da1146600fc2f5a363685f387f81b5b694fa359
Diffstat (limited to 'libs/gui/DisplayEventDispatcher.cpp')
0 files changed, 0 insertions, 0 deletions