pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pdf-devel] Fix time copy test


From: Brad Hards
Subject: [pdf-devel] Fix time copy test
Date: Sat, 13 Jun 2009 19:03:22 +1000
User-agent: KMail/1.9.10

The tpdf_time_copy_001 test doesn't initialise time2, and that causes a 
segfault when we copy into its members.

The API documentation 
(http://gnupdf.org/manuals/gnupdf-manual/html_node/Managing-Time-Values.html#Managing-Time-Values)
 
says that the destination "Should be a properly created time variable", so I 
just initialised it.

There might be a case for adding some protection (e.g. an assert or error 
response) to the pdf_time_copy() function. 

Please apply.

Brad

--- torture/unit/base/time/pdf-time-copy.c      2009-04-16 22:13:38 +0000
+++ torture/unit/base/time/pdf-time-copy.c      2009-06-13 08:52:12 +0000
@@ -48,6 +48,10 @@
   fail_if(status != PDF_OK);
   fail_if(time1 == NULL);

+  status = pdf_time_new(&time2);
+  fail_if(status != PDF_OK);
+  fail_if(time2 == NULL);
+
   seconds = pdf_i64_new(0x12345678,0x9ABCDEF0);

   status = pdf_time_set_from_i64(time1, seconds);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]