Merge "fix EnumeratorFuzzer decStrong issue" into rvc-qpr-dev
diff --git a/evs/manager/1.1/test/fuzzer/EnumeratorFuzzer.cpp b/evs/manager/1.1/test/fuzzer/EnumeratorFuzzer.cpp
index 476dc3f..2d450cc 100644
--- a/evs/manager/1.1/test/fuzzer/EnumeratorFuzzer.cpp
+++ b/evs/manager/1.1/test/fuzzer/EnumeratorFuzzer.cpp
@@ -59,9 +59,6 @@
static sp<IEvsEnumerator_1_1> sMockHWEnumerator;
static sp<Enumerator> sEnumerator;
-static vector<sp<IEvsCamera_1_0>> sVirtualCameras;
-static vector<sp<IEvsDisplay_1_0>> sDisplays;
-
bool DoInitialization() {
setenv("TREBLE_TESTING_OVERRIDE", "true", true);
configureRpcThreadpool(2, false /* callerWillNotJoin */);
@@ -82,6 +79,9 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
FuzzedDataProvider fdp(data, size);
+ vector<sp<IEvsCamera_1_0>> vVirtualCameras;
+ vector<sp<IEvsDisplay_1_0>> vDisplays;
+
// Inititialize the enumerator that we are going to test
static bool initialized = DoInitialization();
sEnumerator = new Enumerator();
@@ -94,7 +94,7 @@
while (fdp.remaining_bytes() > kMaxFuzzerConsumedBytes) {
switch (fdp.ConsumeIntegralInRange<uint32_t>(0, EVS_FUZZ_API_SUM - 1)) {
case EVS_FUZZ_GET_CAMERA_LIST: {
- sEnumerator->getCameraList([](auto list){});
+ sEnumerator->getCameraList([](auto list) {});
break;
}
case EVS_FUZZ_OPEN_CAMERA: {
@@ -104,30 +104,30 @@
hidl_string camStr = std::to_string(whichCam);
sp<IEvsCamera_1_0> virtualCam = sEnumerator->openCamera(camStr);
if (virtualCam != nullptr) {
- sVirtualCameras.emplace_back(virtualCam);
+ vVirtualCameras.emplace_back(virtualCam);
}
break;
}
case EVS_FUZZ_CLOSE_CAMERA: {
- if (!sVirtualCameras.empty()) {
- sp<IEvsCamera_1_0> cam = sVirtualCameras.back();
+ if (!vVirtualCameras.empty()) {
+ sp<IEvsCamera_1_0> cam = vVirtualCameras.back();
sEnumerator->closeCamera(cam);
- sVirtualCameras.pop_back();
+ vVirtualCameras.pop_back();
}
break;
}
case EVS_FUZZ_OPEN_DISPLAY: {
sp<IEvsDisplay_1_0> display = sEnumerator->openDisplay();
if (display != nullptr) {
- sDisplays.emplace_back(display);
+ vDisplays.emplace_back(display);
}
break;
}
case EVS_FUZZ_CLOSE_DISPLAY: {
- if (!sDisplays.empty()) {
- sp<IEvsDisplay_1_0> display = sDisplays.back();
+ if (!vDisplays.empty()) {
+ sp<IEvsDisplay_1_0> display = vDisplays.back();
sEnumerator->closeDisplay(display);
- sDisplays.pop_back();
+ vDisplays.pop_back();
}
break;
}
@@ -136,7 +136,7 @@
break;
}
case EVS_FUZZ_GET_CAMERA_LIST_1_1: {
- sEnumerator->getCameraList_1_1([](auto cams){});
+ sEnumerator->getCameraList_1_1([](auto cams) {});
break;
}
case EVS_FUZZ_OPEN_CAMERA_1_1: {
@@ -147,7 +147,7 @@
Stream streamCfg = {};
sp<IEvsCamera_1_1> virtualCam = sEnumerator->openCamera_1_1(camStr, streamCfg);
if (virtualCam != nullptr) {
- sVirtualCameras.emplace_back(virtualCam);
+ vVirtualCameras.emplace_back(virtualCam);
}
break;
}
@@ -156,7 +156,7 @@
break;
}
case EVS_FUZZ_GET_DISPLAY_LIST: {
- sEnumerator->getDisplayIdList([](auto list){});
+ sEnumerator->getDisplayIdList([](auto list) {});
break;
}
case EVS_FUZZ_OPEN_DISPLAY_1_1: {
@@ -167,7 +167,7 @@
sp<IEvsDisplay_1_1> display = sEnumerator->openDisplay_1_1(
static_cast<uint8_t>(whichDisp));
if (display != nullptr) {
- sDisplays.emplace_back(display);
+ vDisplays.emplace_back(display);
}
break;
}