Repository navigation
Fix remaining security issues of BbScanner (#14501) - #14502
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
| Layer / File(s) | Summary |
|---|---|
Bound MaxiCode bullseye walks src/Utilities/BbScanner/Bit.BbScanner/Decoding/MaxiCode/BbMaxiCodeReader.cs, src/Utilities/BbScanner/Tests/Bit.BbScanner.Tests/MaxiCodeAndMicroQrTests.cs |
Confirm limits directional measurements to twice the row’s inner-run total. Walk stops at that limit and applies run checks. Three tests check that large bullseye-like matrices return null within 10 seconds. |
Document and test QR cross-check bounds src/Utilities/BbScanner/Bit.BbScanner/Decoding/QrCode/BbQrFinderPatternFinder.cs, src/Utilities/BbScanner/Tests/Bit.BbScanner.Tests/QrCodeDecoderTests.cs |
Comments describe existing QR cross-check run-length bounds. Performance tests increase the tall matrix size, reduce its time limit, and add a case with long black rows. |
Validate cutout bounds and pixel length src/Utilities/BbScanner/Bit.BbScanner/Pipeline/BbBarcodeDecoder.cs |
PrepareCutOut checks region bounds using subtraction and validates pixel length with a 64-bit product. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: yasmoradi
Merge Risk: 
Minimal · previous review 9b9dc
-
No merge-blocking issue was identified. The hardening changes appear ready to merge subject to normal build and test checks.
Pre-merge checks: 
3 · 
2
-
Failed checks: 2 warnings Passed checks: 3 passed-
Full details: Out of Scope Changes check
-
Explanation
The changed MaxiCode decoder, QR finder comments and tests,
PrepareCutOutvalidation, and performance tests all address the security and regression objectives in issue#14501. No unrelated change is shown.
-
Full details: Linked Issues check
-
Explanation
Issue
#14501requires overflow-safelongarithmetic for both region-bound and pixel-length checks inPrepareCutOut. The pixel-length product now useslong, but the region checks useintsubtraction inframeWidth - region.WidthandframeHeight - region.Height. The PR bounds MaxiCode walks, adds the requested QR finder comments, and strengthens the QR and MaxiCode timing tests.Resolution
Perform the region-bound comparisons in
longarithmetic. Add or update automated tests that use extreme coordinate and dimension values to verify that invalid regions cannot pass the checks.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 11 functions across 5 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks each ring with care,
Short walks now end before the edge.
Tall stripes and lattices meet the clock,
Safe bounds keep lengths in their place.
I twitch my nose and cheer the scan!
closes #14501
Summary by CodeRabbit