View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000446||file||General||public||2023-05-02 20:01||2023-05-21 15:49|
|Fixed in Version||HEAD|
|Summary||0000446: PDF appendix allows header in first 1024 bytes; Magic looks in 256|
|Description||TL;DR, I think this line needs to be changed to 1024, not 256:|
The Seventh Circuit of Appeals in the United States has started publishing documents that do not comply with the PDF specification, but which do comply with the PDF Compatibility and Implementation notes from Appendix H of the specification. See attached for an example, or this link should work:
The PDF specification says on page 92 that:
> The first line of a PDF file is a header identifying the version of the PDF [...] For a file conforming to PDF 1.7, the header should be:
But Appendix H of the same spec says:
> Acrobat viewers require only that the header appear somewhere within the first 1024 bytes of the file.
A few years ago, this issue came up:
If I'm understanding correctly, a fix was put in place to look in the first 256 bytes of the file, here:
I think we just need to adjust this to look in the first 1024 bytes instead, and it should fix this and other issues.
|Steps To Reproduce||1. Download the file|
2. Run `file the-file.pdf`
3. Note that it's detected as `data`.
4. Do `head the-file.pdf`
5. Note that `%PDF-` is there, but that there's text before it.
6. Study the spec and appendix H
7. Note that this file opens properly in Adobe Reader, and other PDF readers.
8. Note that file doesn't follow the implementation (aka the defacto specification)
|Tags||No tags attached.|
document.pdf (337,981 bytes)
|2023-05-02 20:01||mike||New Issue|
|2023-05-02 20:01||mike||File Added: document.pdf|
|2023-05-21 15:49||christos||Assigned To||=> christos|
|2023-05-21 15:49||christos||Status||new => assigned|
|2023-05-21 15:49||christos||Status||assigned => resolved|
|2023-05-21 15:49||christos||Resolution||open => fixed|
|2023-05-21 15:49||christos||Fixed in Version||=> HEAD|
|2023-05-21 15:49||christos||Note Added: 0003928|