Skip to content

ROB: Skip a Do operator without an operand in extract_text - #4165

Merged
stefan6419846 merged 1 commit into
py-pdf:mainfrom
RavSinghChandan:do-operator-without-operand
Oct 7, 2026
Merged

stefan6419846 merged 1 commit into
py-pdf:mainfrom
RavSinghChandan:do-operator-without-operand

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

A content stream with a bare Do operator, as in

BT /F1 12 Tf (Hello) Tj ET Do BT /F1 12 Tf (World) Tj ET

makes extract_text() raise "IndexError: list index out of range". The call into
_extract_text__xform fails without an operand, and the warning in the except
block reads operands[0] again.

A Do without an operand is now skipped, as the image extraction loop in the same
file already does (elif ope == b"Do" and param:), and as TD and " are guarded
just above. The text around it is kept: the example extracts as "HelloWorld".

Full suite passes locally, 1875 tests.

Used Claude Code (Claude Opus 5.5) to help find and patch this and to draft this description; I reviewed and tested the change.

@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.12%. Comparing base (3ecbbc5) to head (d34c61b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4165      +/-   ##
==========================================
- Coverage   98.12%   98.12%   -0.01%     
==========================================
  Files          59       59              
  Lines       11604    11603       -1     
  Branches     2176     2176              
==========================================
- Hits        11387    11386       -1     
  Misses        123      123              
  Partials       94       94              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stefan6419846
stefan6419846 merged commit 2545e0d into py-pdf:main Oct 7, 2026
21 checks passed
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.

2 participants