Skip to content

ROB: Skip an embedded file specification that is not a dictionary - #4256

Merged
stefan6419846 merged 1 commit into
py-pdf:mainfrom
RavSinghChandan:embedded-file-spec-not-dictionary
Oct 27, 2026
Merged

stefan6419846 merged 1 commit into
py-pdf:mainfrom
RavSinghChandan:embedded-file-spec-not-dictionary

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

reader.attachments crashed with TypeError: argument of type 'NumberObject' is not iterable when an entry of the embedded files name tree points to something that is not a dictionary, for example [(a.txt) 5]. #4037 made the levels above it (the /Names tree, /EmbeddedFiles, /Kids and the name lists) warn and skip, but the file specification itself was used without a check.

_load_from_names() now does the same for the file specification: a non-dictionary is reported with _report_malformed() (a warning, or PdfReadError in strict mode, so strict is now passed down), and a null value is skipped silently like the other null entries. Added the cases to MALFORMED_NAME_TREE_CATALOGS (directly in /Names and in a kid) and to SPEC_CONFORMANT_EMPTY_CATALOGS.

@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4256   +/-   ##
=======================================
  Coverage   98.37%   98.37%           
=======================================
  Files          59       59           
  Lines       11913    11918    +5     
  Branches     2247     2249    +2     
=======================================
+ Hits        11719    11724    +5     
  Misses        106      106           
  Partials       88       88           

☔ 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 4ef744f into py-pdf:main Oct 27, 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