Skip to content

Conversation

@exiledkingcc
Copy link
Contributor

fix #1288

the specification says:

To understand the algorithm below, it is necessary to treat the O and U strings in the Encrypt dictionary
as made up of three sections. The first 32 bytes are a hash value (explained below). The next 8 bytes are
called the Validation Salt. The final 8 bytes are called the Key Salt.

so /U and /O should be 48-bytes data.
but for the pdf which causes #1288 , /O 's length is 127-bytes, the redundant data are zeros.

@pubpub-zz
Copy link
Collaborator

great!

@codecov
Copy link

codecov bot commented Sep 3, 2022

Codecov Report

Merging #1317 (5e17fb2) into main (eb0be4d) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1317   +/-   ##
=======================================
  Coverage   95.06%   95.06%           
=======================================
  Files          30       30           
  Lines        5044     5044           
  Branches     1041     1041           
=======================================
  Hits         4795     4795           
  Misses        141      141           
  Partials      108      108           
Impacted Files Coverage Δ
PyPDF2/_encryption.py 92.62% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@MartinThoma MartinThoma merged commit a61ef5f into py-pdf:main Sep 3, 2022
@MartinThoma
Copy link
Member

Very nice work @exiledkingcc ! Thank you - also for sharing the part of the specifications 🤗 This made it really easy to review / merge the PR

@exiledkingcc exiledkingcc deleted the fix-1288 branch September 3, 2022 13:49
MartinThoma added a commit that referenced this pull request Sep 4, 2022
Version 2.10.5, 2022-09-04
--------------------------

New Features (ENH):
-  Process XRefStm (#1297)
-  Auto-detect RTL for text extraction (#1309)

Bug Fixes (BUG):
-  Avoid scaling cropbox twice (#1314)

Robustness (ROB):
-  Fix offset correction in revised PDF (#1318)
-  Crop data of /U and /O in encryption dictionary to 48 bytes (#1317)
-  MultiLine bfrange in cmap (#1299)
-  Cope with 2 digit codes in bfchar (#1310)
-  Accept '/annn' charset as ASCII code (#1316)
-  Log errors during Float / NumberObject initialization (#1315)
-  Cope with corrupted entries in xref table (#1300)

Documentation (DOC):
-  Migration guide (PyPDF2 1.x \xe2\x9e\x94 2.x) (#1324)
-  Creating a coverage report (#1319)
-  Fix AnnotationBuilder.free_text example (#1311)
-  Fix usage of page.scale by replacing it with page.scale_by (#1313)

Developer Experience (DEV):
-  Only run coverage for PyPDF2

Maintenance (MAINT):
-  PdfReaderProtocol (#1303)
-  Throw PdfReadError if Trailer can't be read (#1298)
-  Remove catching OverflowException (#1302)

Full Changelog: 2.10.4...2.10.5
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.

Error "Stream has ended unexpectedly" on getDocumentInfo with certain pdf file(s)

3 participants