View Issue Details

IDProjectCategoryView StatusLast Update
0000294luatexluatex bugpublic2009-12-18 11:07
ReporterHans Hagen Assigned ToTaco  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
OSWin32 
Target Version0.47.0Fixed in Version0.47.0 
Summary0000294: corrupt pdf file due to no check for inclusion change
DescriptionAs a side effect of delayed inclusion, a corrupt pdf file can be generated when a pdf file with the same name but different content is included.

(example test sent to hartmut)

So, we need a guard i.e. test for file change (timestamp/size) or so.
TagsNo tags attached.

Relationships

related to 0000282 closedTaco Solve problem with pdf inclusion and maximum number of open files 

Activities

Taco

2009-11-30 17:29

administrator   ~0000356

The underlying problem here is (I think) that Windows is perfectly willing to accept other applications overwriting a file that you have already opened for reading. Adding an explicit lock inside xpdf should fix that, via

Index: source/libs/xpdf/xpdf-3.02/xpdf/PDFDoc.cc
===================================================================
--- source/libs/xpdf/xpdf-3.02/xpdf/PDFDoc.cc (revision 3187)
+++ source/libs/xpdf/xpdf-3.02/xpdf/PDFDoc.cc (working copy)
@@ -18,6 +18,8 @@
 #include <string.h>
 #ifdef WIN32
 # include <windows.h>
+# include <io.h>
+# include <sys/locking.h>
 #endif
 #include "GString.h"
 #include "config.h"
@@ -127,6 +129,8 @@
     errCode = errOpenFile;
     return;
   }
+ /* block other processes from messing with the file */
+ _locking(_fileno(file), _LK_LOCK, 0xFFFFFFFFL);

   // create stream
   obj.initNull();

Taco

2009-11-30 17:59

administrator   ~0000357

Revision #3200 acquires an exclusive lock on the pdf file under win32

Issue History

Date Modified Username Field Change
2009-11-09 12:37 Hans Hagen New Issue
2009-11-09 12:37 Hans Hagen Status new => assigned
2009-11-09 12:37 Hans Hagen Assigned To => hhenkel
2009-11-18 12:13 Taco Relationship added related to 0000282
2009-11-30 17:29 Taco Note Added: 0000356
2009-11-30 17:58 Taco OS => Win32
2009-11-30 17:59 Taco Status assigned => resolved
2009-11-30 17:59 Taco Resolution open => fixed
2009-11-30 17:59 Taco Note Added: 0000357
2009-12-02 14:35 Taco Assigned To hhenkel => Taco
2009-12-02 14:35 Taco Target Version => 0.50.0
2009-12-18 11:06 Taco Target Version 0.50.0 => 0.47.0
2009-12-18 11:06 Taco Fixed in Version => 0.47.0
2009-12-18 11:07 Taco Status resolved => closed