Fix the OSS-Fuzz build error caused by the warning of unused variables in ecc_map_ex #9648
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a fuzzing build error caused by unused variables (x, y, z) in wolfcrypt/src/ecc.c when compiling with -Werror and specific configurations .
In the function ecc_map_ex, the variables x, y, and z were declared at the top of the function but are only used within a specific #if !defined(WOLFSSL_SP_MATH) block. When WOLFSSL_SP_MATH is defined, these variables remain unused, triggering a -Wunused-variable error in strict build environments like OSS-Fuzz.
The fix moves the declaration of these variables into the inner scope where they are actually used, resolving the warning/error without changing any logic.
Fixes build error seen in OSS-Fuzz environments.
Testing
git clone https://github.com/google/oss-fuzz.git
git clone https://github.com/wolfSSL/wolfssl.git
cd oss-fuzz/
python3.10 infra/helper.py build_fuzzers wolfssl ~/wolfssl --sanitizer address --engine honggfuzz --architecture x86_64
In this way, you can see the same error message as described below.
After using the PR code, the fuzzing build can be successfully carried out.
Fuzzing build error URL
https://oss-fuzz-build-logs.storage.googleapis.com/index.html#wolfssl