From c4f3f80ebad5dabc74fa5016a48e0d2762250678 Mon Sep 17 00:00:00 2001 From: bailu1992 Date: Mon, 11 Aug 2025 21:33:00 +0800 Subject: [PATCH 1/2] Modification of the fuzz test case Signed-off-by: bailu1992 --- .vscode/c_cpp_properties.json | 18 ++++++ .vscode/launch.json | 24 ++++++++ .vscode/settings.json | 59 +++++++++++++++++++ .../destroyclientremoteobjectstub_fuzzer.cpp | 1 + .../resetsensorsstub_fuzzer.cpp | 1 + 5 files changed, 103 insertions(+) create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 00000000..77126915 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "windows-gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "D:/tools/mingw64/bin/gcc.exe", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "windows-gcc-x64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..5341bafb --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": true, + "cwd": "d:/bailu/code/sensor0811/sensors_sensor/test/fuzztest/services/resetsensorsstub_fuzzer", + "program": "d:/bailu/code/sensor0811/sensors_sensor/test/fuzztest/services/resetsensorsstub_fuzzer/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..bb879da5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,59 @@ +{ + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false +} \ No newline at end of file diff --git a/test/fuzztest/services/destroyclientremoteobjectstub_fuzzer/destroyclientremoteobjectstub_fuzzer.cpp b/test/fuzztest/services/destroyclientremoteobjectstub_fuzzer/destroyclientremoteobjectstub_fuzzer.cpp index 6eecd278..29294ad3 100644 --- a/test/fuzztest/services/destroyclientremoteobjectstub_fuzzer/destroyclientremoteobjectstub_fuzzer.cpp +++ b/test/fuzztest/services/destroyclientremoteobjectstub_fuzzer/destroyclientremoteobjectstub_fuzzer.cpp @@ -85,6 +85,7 @@ bool OnRemoteRequestFuzzTest(const uint8_t *data, size_t size) MessageParcel datas; datas.WriteInterfaceToken(SENSOR_INTERFACE_TOKEN); datas.WriteRemoteObject(g_remote); + datas.WriteBuffer(data, size); datas.RewindRead(0); MessageParcel reply; MessageOption option; diff --git a/test/fuzztest/services/resetsensorsstub_fuzzer/resetsensorsstub_fuzzer.cpp b/test/fuzztest/services/resetsensorsstub_fuzzer/resetsensorsstub_fuzzer.cpp index dd85c8c5..a5233293 100644 --- a/test/fuzztest/services/resetsensorsstub_fuzzer/resetsensorsstub_fuzzer.cpp +++ b/test/fuzztest/services/resetsensorsstub_fuzzer/resetsensorsstub_fuzzer.cpp @@ -66,6 +66,7 @@ bool OnRemoteRequestFuzzTest(const uint8_t *data, size_t size) SetUpTestCase(); MessageParcel datas; datas.WriteInterfaceToken(SENSOR_INTERFACE_TOKEN); + datas.WriteBuffer(data, size); datas.RewindRead(0); MessageParcel reply; MessageOption option; -- Gitee From 8e65a97c565a36819922f956f2cf9ff18b5978b4 Mon Sep 17 00:00:00 2001 From: bailu1992 Date: Mon, 11 Aug 2025 21:33:30 +0800 Subject: [PATCH 2/2] Modification of the fuzz test case Signed-off-by: bailu1992 --- .vscode/c_cpp_properties.json | 18 ----------- .vscode/launch.json | 24 -------------- .vscode/settings.json | 59 ----------------------------------- 3 files changed, 101 deletions(-) delete mode 100644 .vscode/c_cpp_properties.json delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/settings.json diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index 77126915..00000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "configurations": [ - { - "name": "windows-gcc-x64", - "includePath": [ - "${workspaceFolder}/**" - ], - "compilerPath": "D:/tools/mingw64/bin/gcc.exe", - "cStandard": "${default}", - "cppStandard": "${default}", - "intelliSenseMode": "windows-gcc-x64", - "compilerArgs": [ - "" - ] - } - ], - "version": 4 -} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 5341bafb..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "C/C++ Runner: Debug Session", - "type": "cppdbg", - "request": "launch", - "args": [], - "stopAtEntry": false, - "externalConsole": true, - "cwd": "d:/bailu/code/sensor0811/sensors_sensor/test/fuzztest/services/resetsensorsstub_fuzzer", - "program": "d:/bailu/code/sensor0811/sensors_sensor/test/fuzztest/services/resetsensorsstub_fuzzer/build/Debug/outDebug", - "MIMode": "gdb", - "miDebuggerPath": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index bb879da5..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "C_Cpp_Runner.cCompilerPath": "gcc", - "C_Cpp_Runner.cppCompilerPath": "g++", - "C_Cpp_Runner.debuggerPath": "gdb", - "C_Cpp_Runner.cStandard": "", - "C_Cpp_Runner.cppStandard": "", - "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat", - "C_Cpp_Runner.useMsvc": false, - "C_Cpp_Runner.warnings": [ - "-Wall", - "-Wextra", - "-Wpedantic", - "-Wshadow", - "-Wformat=2", - "-Wcast-align", - "-Wconversion", - "-Wsign-conversion", - "-Wnull-dereference" - ], - "C_Cpp_Runner.msvcWarnings": [ - "/W4", - "/permissive-", - "/w14242", - "/w14287", - "/w14296", - "/w14311", - "/w14826", - "/w44062", - "/w44242", - "/w14905", - "/w14906", - "/w14263", - "/w44265", - "/w14928" - ], - "C_Cpp_Runner.enableWarnings": true, - "C_Cpp_Runner.warningsAsError": false, - "C_Cpp_Runner.compilerArgs": [], - "C_Cpp_Runner.linkerArgs": [], - "C_Cpp_Runner.includePaths": [], - "C_Cpp_Runner.includeSearch": [ - "*", - "**/*" - ], - "C_Cpp_Runner.excludeSearch": [ - "**/build", - "**/build/**", - "**/.*", - "**/.*/**", - "**/.vscode", - "**/.vscode/**" - ], - "C_Cpp_Runner.useAddressSanitizer": false, - "C_Cpp_Runner.useUndefinedSanitizer": false, - "C_Cpp_Runner.useLeakSanitizer": false, - "C_Cpp_Runner.showCompilationTime": false, - "C_Cpp_Runner.useLinkTimeOptimization": false, - "C_Cpp_Runner.msvcSecureNoWarnings": false -} \ No newline at end of file -- Gitee