Skip to content

Fix checked native barcode crop bounds - #540

Merged
Szer merged 2 commits into
mainfrom
fix/coupon-native-crop-bounds
Sep 30, 2026
Merged

Szer merged 2 commits into
mainfrom
fix/coupon-native-crop-bounds

Conversation

@Szer

@Szer Szer commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Horizontal barcode crops retained the image's row stride but supplied a span shorter than ZXingCpp's checked ImageView requires. Valid images therefore threw an out-of-bounds exception and prematurely abandoned the remaining native crops.

Supply the full required stride and add one trailing row of managed buffer padding so bottom-edge crops also remain within bounds. This retains bounded spans and scoped pinning, with no unsafe code or per-crop pixel copies. Extract the native reader so behavioral regression tests can observe failures otherwise hidden by managed fallback.

Validation:

  • Reproduced before fixing: three blank-image cases failed with the production exception; both affected production photos and four existing fixtures also reproduced it.
  • Offline OCR suite: 34 tests pass, including blank-image and difficult-fixture regressions.
  • Saved 2,201-image corpus: zero native exceptions and unchanged barcode outputs.
  • Both production photos now complete native search without exceptions; their final recognition results remain unchanged.

Coupon build and deploy tests use Ubuntu 24.04 ARM, matching the production image’s Noble base. Ubuntu 22.04 cannot load the packaged native library because it requires GLIBC_2.38; direct reader regressions exposed this previously hidden fallback. Other bots retain their existing runner default.

@Szer
Szer merged commit bba1761 into main Sep 30, 2026
9 checks passed
@Szer
Szer deleted the fix/coupon-native-crop-bounds branch September 30, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant