You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes all findings from CodeQL Analysis and SonarCloud in run 35445715059 with zero intended behavioral change (1416 -> 1420 tests; the 4 new tests close a genuine coverage gap found while investigating one issue).
SonarCloud (16 issues)
Removed genuinely dead code in PngCodec.Load (S2583 "always true" condition) after proving via a new regression test that the code path was unreachable, not a static-analysis limitation.
Reduced Cognitive Complexity of 10 methods across JpegCodec.cs/PngCodec.cs/TiffCodec.cs via extract-method refactoring only (no algorithm changes).
Reduced parameter counts on 3 JpegCodec methods using parameter-object record structs.
Replaced Enum.IsDefined(Type, object) with the generic overload (CA2263) everywhere it appeared.
Changed an untyped MemberData source to a properly-typed theory data row (xUnit1042).
CodeQL (60 alerts)
Disposed all previously-undisposed MemoryStream instances in test files.
Fixed Path.Combine rooted-path ambiguity (cs/path-combine) by switching to Path.Join (via the Polyfill package for net481 support), since folder-breakout isn't a concern for these hardcoded fixture-file literals.
Confirmed cs/missed-ternary-operator hits are in xUnit-generated obj/ build output, not source we control; added /obj///bin/ to .github/codeql-config.yml path-ignore.
Fixed a loss-of-precision int/double arithmetic ordering issue in the JPEG IDCT basis-matrix construction.
Applied a .Where() LINQ filter suggestion (cs/linq/missed-where).
Replace the previously-committed Path.Combine(baseDirectory,
Path.GetFileName(fileName)) sanitization approach with Path.Join
(baseDirectory, fileName) in the ResolveFixturePath helpers across
JpegFixtureTests.cs, PngSuiteTests.cs, and TiffFixtureTests.cs.
Path.Join lacks Path.Combine's rooted-path-discard behavior, so it
doesn't trigger CodeQL's cs/path-combine rule at all. Path injection
is not a concern since every fileName is a hardcoded literal from
TheoryData<string>.
Path.Join is unavailable on .NET Framework, and this test project
genuinely targets net481 on Windows, so the fix uses conditional
compilation: net481 keeps the original Path.GetFileName-sanitized
Path.Combine call (never scanned by CodeQL, which only analyzes
net8.0/net9.0/net10.0 on Linux), while all modern target frameworks
use Path.Join.
Added NETFRAMEWORK to .cspell.yaml (verified necessary: lint.ps1
fails on the unrecognized preprocessor symbol without it).
All 1420 tests still passing, 0 failures. dotnet build, reqstream
--enforce, reviewmark --enforce, and lint.ps1 all pass clean.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a Polyfill package reference (version 11.3.0, matching the main
library) to the test project so Path.Join(string, string) resolves
uniformly on net481, replacing the prior #if NETFRAMEWORK / #else
dual-branch ResolveFixturePath implementation with a single
unconditional Path.Join(baseDirectory, fileName) call in
JpegFixtureTests.cs, PngSuiteTests.cs, and TiffFixtureTests.cs.
Add PolyUseEmbeddedAttribute=true to the main library's csproj to
resolve a genuine CS0121 ambiguous-call error that otherwise occurs
once both the library and test project reference Polyfill (the
library's InternalsVisibleTo exposes its embedded polyfill types to
the test assembly, colliding with the test project's own embedded
copy). Verified by reproducing the CS0121 error with the setting
removed and confirming it disappears when restored.
Removed the now-unused NETFRAMEWORK entry from .cspell.yaml since the
conditional-compilation branch it guarded no longer exists anywhere
in the repo.
All four target frameworks (net481, net8.0, net9.0, net10.0) build
with 0 warnings/0 errors; net481 test execution explicitly confirmed
passing. 1420/1420 tests passing overall, 0 failures. dotnet build,
reqstream --enforce, reviewmark --enforce, and lint.ps1 all pass
clean. Zero behavioral change: Path.Join and the prior
Path.Combine(baseDirectory, Path.GetFileName(fileName)) fallback
produce identical results for every flat, non-rooted fixture filename
literal used across all three test files.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pers
Introduces a RefinementParams record struct grouping the bit reader,
end-of-band index, and positive/negative refinement bit values shared
by RefineNonZeroCoefficient, RefineRemainingCoefficients,
DecodeAcRefineNewCoefficients, and RefineOrPlaceCoefficient, bringing
DecodeAcRefineNewCoefficients and RefineOrPlaceCoefficient down from 8
parameters to 5, matching the pattern already used elsewhere in this
file. Pure refactor, no behavior change.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This updated reader has separate pre-IHDR rejection branches for IDAT and IEND, but the regression test linked by the new requirement only constructs IEND; no test exercises an IDAT-before-IHDR stream. Add an IDAT case (or parameterize the test) so either branch cannot regress independently.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Summary
Fixes all findings from CodeQL Analysis and SonarCloud in run 35445715059 with zero intended behavioral change (1416 -> 1420 tests; the 4 new tests close a genuine coverage gap found while investigating one issue).
SonarCloud (16 issues)
CodeQL (60 alerts)
Validation
dotnet build— 0 warnings, 0 errorspwsh ./build.ps1— 1420/1420 tests passing (net481, net8.0, net9.0, net10.0)dotnet reqstream --enforce— cleandotnet reviewmark --plan --enforce— no coverage-gap warningspwsh ./lint.ps1— exit 0CodeQL/SonarCloud rescans will confirm on this PR's CI run.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com