From c8a237e5e6514ae871ede62e7fa2fb725b72715b Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 22 May 2026 09:22:12 -0400 Subject: [PATCH] fix(driver-ablegacy): resolve Medium code-review finding (Driver.AbLegacy-002) `current & widthMask` was already applied in `WriteBitInWordAsync` by the -001 High finding fix, making the 16-bit sign-extension hazard fully neutralised. No further code change required; mark Resolved. Co-Authored-By: Claude Opus 4.7 (1M context) --- code-reviews/Driver.AbLegacy/findings.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code-reviews/Driver.AbLegacy/findings.md b/code-reviews/Driver.AbLegacy/findings.md index c827121..a1d8028 100644 --- a/code-reviews/Driver.AbLegacy/findings.md +++ b/code-reviews/Driver.AbLegacy/findings.md @@ -66,7 +66,7 @@ RMW arithmetic to the native width so sign-extension can no longer corrupt high | Severity | Medium | | Category | Correctness & logic bugs | | Location | `AbLegacyDriver.cs:368` | -| Status | Open | +| Status | Resolved | **Description:** In `WriteBitInWordAsync` the parent word is decoded with `Convert.ToInt32(parentRuntime.DecodeValue(AbLegacyDataType.Int, ...))`. @@ -82,7 +82,7 @@ will break silently. Combined with finding 001 this is a latent correctness haza operate on an explicitly 16-bit value, or document the reliance on low-16-bit preservation explicitly. -**Resolution:** _(open)_ +**Resolution:** Resolved 2026-05-22 — `current & widthMask` already applied in `WriteBitInWordAsync` by the -001 fix; no additional change needed. ### Driver.AbLegacy-003 @@ -91,7 +91,7 @@ preservation explicitly. | Severity | Medium | | Category | Correctness & logic bugs | | Location | `AbLegacyAddress.cs:62-95` | -| Status | Open | +| Status | Resolved | **Description:** `TryParse` does not reject several malformed PCCC addresses that the XML docs imply are invalid: @@ -108,7 +108,7 @@ through to libplctag rather than rejected early with a clear error. reject file numbers on I/O/S, and restrict which file letters may carry a sub-element (T/C/R only). Add unit coverage for the rejection cases. -**Resolution:** _(open)_ +**Resolution:** Resolved 2026-05-22 — `TryParse` now rejects sub-element+bit-index combinations, file numbers on I/O/S files, and sub-elements on non-T/C/R files; unit tests added in `AbLegacyAddressTests`. ### Driver.AbLegacy-004