Initialize encoder fuzz ServiceMessageContext (OPC 10000-6)#4035
Initialize encoder fuzz ServiceMessageContext (OPC 10000-6)#4035marcschier wants to merge 3 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
This PR ensures the encoder fuzz host always has an initialized OPC UA ServiceMessageContext even when started directly (e.g., afl-fuzz/libFuzzer), by moving initialization into the fuzz target code and removing test/tool reassignment.
Changes:
- Initialize a single process-lifetime
ServiceMessageContextinFuzzableCodeusing a null-logging telemetry context. - Remove prior test/tool setup that reassigned
FuzzableCode.MessageContext. - Add a regression test asserting
MessageContextis available without per-test setup.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| fuzzing/Opc.Ua.Encoders.Fuzz/FuzzableCode.cs | Adds default, process-lifetime ServiceMessageContext initialization using null logging telemetry. |
| fuzzing/Opc.Ua.Encoders.Fuzz.Tools/Encoders.Testcases.cs | Stops reassigning the global message context; keeps telemetry parameter for signature compatibility. |
| fuzzing/Opc.Ua.Encoders.Fuzz.Tests/Issue3546RoundTripTests.cs | Removes NUnit setup that previously created/reassigned the message context. |
| fuzzing/Opc.Ua.Encoders.Fuzz.Tests/EncoderTests.cs | Replaces per-test setup override with a regression test for context initialization. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4035 +/- ##
==========================================
- Coverage 73.86% 73.56% -0.31%
==========================================
Files 1345 1345
Lines 180038 180081 +43
Branches 31678 31683 +5
==========================================
- Hits 132993 132472 -521
- Misses 36290 36897 +607
+ Partials 10755 10712 -43 🚀 New features to boost your workflow:
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Failure
The encoder fuzz host relied on NUnit or corpus-tool setup to assign
FuzzableCode.MessageContext. Direct afl-fuzz/libFuzzer startup could thereforereach encoder targets without an initialized OPC UA message context.
Fix
ServiceMessageContextwith null logging.Reference
Tests
dotnet test fuzzing\Opc.Ua.Encoders.Fuzz.Tests\Opc.Ua.Encoders.Fuzz.Tests.csproj -c Release -f net10.0 --nologo(4,569 passed)dotnet run --project fuzzing\Opc.Ua.Encoders.Fuzz\Opc.Ua.Encoders.Fuzz.csproj -c Release --(standalone smoke passed)