1 /**
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <media/omx/1.0/WOmx.h>
18 #include <media/stagefright/omx/1.0/Omx.h>
19 #include <s_tmp3dec_file.h> // from the mp3dec library
20 
21 #include "../includes/common.h"
22 #include "../includes/memutils_track.h"
23 #include "../includes/omxUtils.h"
24 
25 char enable_selective_overload = ENABLE_NONE;
is_tracking_required(size_t size)26 bool is_tracking_required(size_t size) {
27   return (size == sizeof(tmp3dec_file));
28 }
29 
main()30 int main() {
31 
32 #if _32_BIT
33   android::ProcessState::self()->startThreadPool();
34   using namespace ::android::hardware::media::omx::V1_0;
35   sp<IOmx> omx = new implementation::Omx();
36   if (!omx) {
37     return EXIT_FAILURE;
38   }
39   sp<IOMX> mOMX = new utils::LWOmx(omx);
40   if (!mOMX) {
41     return EXIT_FAILURE;
42   }
43   sp<IOMXNode> mOMXNode = nullptr;
44   enable_selective_overload = ENABLE_MALLOC_CHECK;
45   mOMX->allocateNode("OMX.google.mp3.decoder", NULL, &mOMXNode);
46   enable_selective_overload = ENABLE_NONE;
47   if (is_memory_uninitialized()) {
48     return EXIT_VULNERABLE;
49   }
50 #endif /* _32_BIT */
51 
52   return EXIT_SUCCESS;
53 }
54