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