Re:What is the smallest possible valid PDF?
by jahewson on Friday March 20, 2020 @10:27PM
(#22643734)
Realistically, yes, but strictly speaking PDFs start with a footer and most PDF readers will accept highly corrupt files.
Re:What is the smallest possible valid PDF?
by rovr138 on Friday March 20, 2020 @12:08PM
(#22638711)
Depends. If you need to parse it, that might still cause errors.
Re:What is the smallest possible valid PDF?
by eesmith on Friday March 20, 2020 @12:19PM
(#22638799)
Agreed.
Though when I think of "detector" I think more of https://en.wikipedia.org/wiki/File_(command) and not something which verifies the file is in the correct format.
Re:What is the smallest possible valid PDF?
by BiteCode_dev on Friday March 20, 2020 @01:07PM
(#22639235)
Well...
file 'setupTests.ts' setupTests.ts: Java source, ASCII text
I wouldn't put too much trust in file.
Re:What is the smallest possible valid PDF?
by klodolph on Friday March 20, 2020 @01:16PM
(#22639335)
I don’t know what you expected. File is just there to give a good guess at a file’s format. There are a ton of reasons why this problem is hard, and there are reasons to make “file” less accurate in order to make the implementation simpler and more secure.
But it will work fine for PDFs, often enough.
That is, do you need a "valid PDF" detector or "more likely a PDF than anything else" detector?