Bug 697469 - digest signature create a wrong byterange
Summary: digest signature create a wrong byterange
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: 1.10
Hardware: PC Windows 10
: P4 major
Assignee: MuPDF bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-09 20:03 UTC by luoxing
Modified: 2017-01-10 17:50 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
code pdf,cert password(testtest) (4.93 KB, application/x-rar)
2017-01-09 20:03 UTC, luoxing
Details

Note You need to log in before you can comment on or make changes to this bug.
Description luoxing 2017-01-09 20:03:15 UTC
Created attachment 13281 [details]
code pdf,cert password(testtest)

signature byterange error
<</ByteRange[2147483647 2147483647 2147483647 2147483647]/Contents<00000000000000000000000000000000000000000000000000000000000000000....

can't complete the signature
Comment 1 luoxing 2017-01-09 21:50:11 UTC
1.9a is worked an the same code
Comment 2 luoxing 2017-01-10 17:50:55 UTC
the reason is in function pdf_save_document() too early finalise PDF_Write_state, and too late write the file tail。

change the code in pdf_save_document() can resolve the problem.
fz_try(ctx)
	{
		initialise_write_state(ctx, doc, in_opts, &opts); 
		do_pdf_save_document(ctx, doc, &opts, in_opts);
		fz_drop_output(ctx, opts.out);
		opts.out = NULL;
		complete_signatures(ctx, doc, &opts, filename);
	}
	fz_always(ctx)
	{
		finalise_write_state(ctx, &opts);
	}
	fz_catch(ctx)