atsushieno / aap-core

an Audio Plugin Format/Framework for Android
MIT License
91 stars 3 forks source link

API mismatch in AIDL: `extension()` does not pass opcode but service expects it #152

Closed atsushieno closed 1 year ago

atsushieno commented 1 year ago

There seems a surprising overlook. In AudioPluginInterface.aidl, extension() is defined as:

void extension(int instanceID, String uri, int size);

However, when it is passed to extension() in AudioPluginInterfaceImpl.h, it is passed to LocalPluginInstance::controlExtension() as:

instance->controlExtension(in_uri, in_size);

while controlExtension() is defined as:

void controlExtension(const std::string &uri, int32_t opcode)

in_size is passed as opcode. That's wrong and anything could happen.

In many cases it wouldn't have caused undefined behaviors as the shared memory content is stable and size usually does not matter. But this definitely needs fixes.