Skip to content
Snippets Groups Projects
Commit 821ea77a authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Fix signature detection for QPDF-367-0.pdf

We added QPDF-367-0.pdf as a regression test, but it also contains
a different type of signature we don't currently support.

Since we already have it in tree extend the regex to also detect it.
parent 9b8b6ac6
No related branches found
No related tags found
1 merge request!69getPDFSignatureCount: fix "too much recursion" error with some PDFs
Pipeline #87042 passed
......@@ -132,7 +132,7 @@ export const readArrayBufferFileContent = async (file) => {
*/
export const getPDFSignatureCount = async (file) => {
const sigRegex = new RegExp(
'/Type\\s*/Sig[\\s\\S]*?/SubFilter\\s*(/ETSI\\.CAdES\\.detached|/adbe\\.pkcs7\\.detached)',
'(/Type\\s*/Sig|/Filter\\s*/Adobe.PPKLite)[\\s\\S]*?/SubFilter\\s*(/ETSI\\.CAdES\\.detached|/adbe\\.pkcs7\\.detached)',
'g'
);
const content = await readBinaryFileContent(file);
......
......@@ -76,7 +76,7 @@ suite('pdf signature detection', () => {
return getPDFFile(await resp.arrayBuffer());
}
assert.equal((await getPDFSignatureCount(await getRealPDFFile('QPDF-367-0.pdf'))), 0);
assert.equal((await getPDFSignatureCount(await getRealPDFFile('QPDF-367-0.pdf'))), 1);
assert.equal((await getPDFSignatureCount(await getRealPDFFile('qual-sig-simple.pdf'))), 1);
assert.equal((await getPDFSignatureCount(await getRealPDFFile('qual-sig-tugraz-multiple.pdf'))), 2);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment