OSDN Git Service

Fix RS HIDL server, pass data by bytes instead of by elements.
authorMichael Butler <butlermichael@google.com>
Mon, 27 Mar 2017 21:14:18 +0000 (14:14 -0700)
committerMichael Butler <butlermichael@google.com>
Thu, 30 Mar 2017 00:09:57 +0000 (17:09 -0700)
commitfd14e27b8997da6b453174af2af2e1cf66e01b5d
treec96d1f0ef543d3a3e617dd8855f87774ed1780c6
parente3a0c607cd05aedcda889877a9605a381d1af870
Fix RS HIDL server, pass data by bytes instead of by elements.

  Our current stack:
  API->API_TO_HAL_translator->HAL
          ->HAL_TO_Implementation_translator->Implementation

  For most APIs:
  - API passes objectCount.
  - HAL expects objectCount.
  - Implementation expects objectCount.

  For APIs like ScriptGroupCreate:
  - API passes byteCount. And unfortunately, these APIs are part of
    NDK, we could not make them also passing objectCount like others.
  - HAL expects objectCount.
  - Implementation expects byteCount.

  So that both API_TO_HAL_translator and
  HAL_TO_Implementation_translator should correctly convert input
  objectCount/byteCount to byteCount/objectCount.

  This CL only fixes the HAL_TO_Implementation_translator part,
  whereas aosp/356395 fixes the API_TO_HAL_translator part. Both
  parts were mistakenly using byteCount as objectCount, causing
  potential out-of-bound access.

Bug: 36404879
Test: mm on angler
Change-Id: I28541a8926aeafece40e2a3f664bda67e26a34a2
renderscript/1.0/default/Context.cpp