We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

When certain timestamp servers and EnableLtv=true we get "Arithmetic operation resulted in an overflow." exception when saving PDF document

Hello,

When using timestamp server http://timestamp.digicert.com or https://freetsa.org/tsr and EnableLtv=true we get an Overflow exception with message 'Arithmetic operation resulted in an overflow.' when saving the PDF. 

When using timestamp server 'http://timestamp.ermis.gov.gr/TSS/HttpTspServer' with EnableLtv=true we don't get this exception.
When using timestamp server 'http://timestamp.digicert.com' with EnableLtv=false we don't get this exception. When set EnableLtv=true we get the exception.

We are using version 17.3.0.19 of Syncfusion.Pdf.Net.Core

Sample code:
            //Create PDF
            using (PdfDocument document = new PdfDocument())
            {
                //Load certificate
                PdfCertificate pdfCert = null;
                using (FileStream certificateStream1 = new FileStream(@".pfx", FileMode.Open, FileAccess.Read))
                {
                    pdfCert = new PdfCertificate(certificateStream1, "");
                }

                //Add a page to the document.
                PdfPage page = document.Pages.Add();

                //Draw the text.
                page.Graphics.DrawString("Hello World!!!", new PdfStandardFont(PdfFontFamily.Helvetica, 20), PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));

                //Add a signature.
                PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
                signature.TimeStampServer = new TimeStampServer(new Uri(@"http://timestamp.digicert.com")); 
                signature.EnableLtv = true;

                //Save to file system
                using (Stream tempPdfNameStream = new FileStream("file.pdf", FileMode.Create))
                {
                    document.Save(tempPdfNameStream);
                }
                document.Close();
            }


Regards,
Jeffrey

6 Replies

GK Gowthamraj Kumar Syncfusion Team October 28, 2019 08:25 AM UTC

Hi Jeffrey, 

Thank you for using Syncfusion products. 

Currently we are trying to reproduce the reported issue in our end and we will update the further details on October 30th 2019. 

Regards, 
Gowthamraj K 



SL Sowmiya Loganathan Syncfusion Team October 30, 2019 02:15 PM UTC

Hi Jeffrey, 

We have tried to reproduce the mentioned issue with the provided code snippet. But we regret to let you know that we were unable to reproduce it. Please find the sample for the same and output document from below link, 


We suspect that the issue seems to be the file (.pfx) specific. So could you please share us the PFX file which you have used in your end, it will helpful for us to provide the precise solution on this. However we will analyze and provide the further details by 1st November, 2019.  

Regards, 
Sowmiya Loganathan 



PG Pon Geetha A J Syncfusion Team October 31, 2019 05:01 AM UTC

Hello, 
 
When we run you source code we can also not reproduce it. Once we replace the certificate with our own certificate we have the issue.  
The certificate we are using is not an own generated certificate but from a certificate authority. So we cannot upload it to the forum. Can we just reply to this email or …? 

We are also using .NET core 3.0 and not .NET core 2.1. You get a different error is using a different .NET core framework. 

If using .NET core 3.0 then we get exception: Arithmetic operation resulted in an overflow. 
   at Syncfusion.Pdf.Security.PdfSignatureDictionary.DocumentSaved(Object sender, DocumentSavedEventArgs e) 
   at Syncfusion.Pdf.PdfDocumentBase.OnDocumentSaved(DocumentSavedEventArgs args) 
   at Syncfusion.Pdf.PdfDocument.Save(Stream stream) 
   at NETCoreSample.Program.Main(String[] args) in C:\Temp\NETCoreSample116733554\NETCoreSample\NETCoreSample\Program.cs:line 44 

If using .NET core 2.1 then we get exception: Array dimensions exceeded supported range. 
   at Syncfusion.Pdf.Security.PdfSignatureDictionary.DocumentSaved(Object sender, DocumentSavedEventArgs e) 
   at Syncfusion.Pdf.PdfDocument.Save(Stream stream) 
   at NETCoreSample.Program.Main(String[] args) in C:\Temp\NETCoreSample116733554\NETCoreSample\NETCoreSample\Program.cs:line 44 

Thanks. 

Regards, 
Jeffrey 




SL Sowmiya Loganathan Syncfusion Team November 1, 2019 11:37 AM UTC

Hi Jeffrey, 
 
Based on the stack trace, We have created a test patch to resolve the issue. Kindly tried the test patch your side and share the details. 
 
Please find sample with test patch assembly below, 
 
Regards, 
Sowmiya Loganathan 



JE Jeffrey November 1, 2019 04:24 PM UTC

Hello,

I tried the test path with our own certificate and I can confirm that the test patch is working.
Good job.

Regards,
Jeffrey


SL Sowmiya Loganathan Syncfusion Team November 4, 2019 11:39 AM UTC

Hi Jeffrey, 

Please find the patch for the reported issue from below and which can be downloaded from the following location.   

Recommended approach - exe will perform automatic configuration  
Please find the patch setup from below location:  

Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment  
Please find the patch assemblies alone from below location:  

 
Assembly Version: 17.3.0.14  
 
Installation Directions :   
This patch should replace the files “Syncfusion.Pdf.Portable.dll” under the following folder.  
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version# 
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\17.3.0.14 \precompiledassemblies\17.3.0.14 

To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you will have to manually copy and paste them to the preferred location or you will have to run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.  
Disclaimer :   
Please note that we have created this patch for version 17.3.0.14 specifically to resolve the following issue(s) reported in this/the Incident(s). 148569  
If you have received other patches for the same version for other products, please apply all patches in the order received.  

This fix will be included in our 2019 Volume 4 release which will be available by December 2019 tentatively. 
 
Regards, 
Sowmiya Loganathan 


Loader.
Live Chat Icon For mobile
Up arrow icon