Skip to content

fix(detect): Guard against zero-height pixmap segfault#206

Open
mlissner wants to merge 2 commits into
filter-bright-color-luminance-20260402from
fix-zero-height-pixmap-segfault-20260402
Open

fix(detect): Guard against zero-height pixmap segfault#206
mlissner wants to merge 2 commits into
filter-bright-color-luminance-20260402from
fix-zero-height-pixmap-segfault-20260402

Conversation

@mlissner
Copy link
Copy Markdown
Member

@mlissner mlissner commented Apr 2, 2026

Summary

  • Skip pixmaps with zero width or height before accessing is_unicolor or samples
  • PyMuPDF produces these from certain degenerate clip rectangles and segfaults if you touch them
  • Fixes crashes on at least two real-world court filing PDFs
  • Add test_short_text_redaction true positive test to ensure short real redactions (e.g., 34) continue to be detected

Test plan

🤖 Generated with Claude Code

Some PDFs produce degenerate clip rectangles that render as 0-height
pixmaps. Accessing is_unicolor or samples on these causes a segfault
in PyMuPDF. Skip them early.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mlissner mlissner marked this pull request as ready for review April 2, 2026 10:21
Ensures short but real redactions (two-character numbers) continue
to be detected and aren't filtered by the single-char check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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