qzind / qz-print

Archive for legacy qz-print versions (1.8, 1.9). See https://github.com/qzind/tray for modern versions.
Other
141 stars 101 forks source link

Segmentation fault building NSIS on Fedora #54

Closed tresf closed 9 years ago

tresf commented 9 years ago

When attempting to build a windows installer on Fedora 22

ant nsis

The nsis process ends in segfault

Processed 1 file, writing output:
Adding plug-ins initializing function.... Done!
Processing pages.... Done!
Generating language tables... Done!
Segmentation fault (core dumped)

This seems to be an upstream RedHat bug that was never patched per https://bugzilla.redhat.com/show_bug.cgi?id=948074#c20.

According to the LLVM source DWORD would be correct for e_lfanew.. (reference: http://llvm.org/docs/doxygen/html/Object_2COFF_8h_source.html ).

on line 757 of ResourceEditor.cpp the cRDataE->m_dwWrittenAt member is cast as a pointer of a struct. However.. m_dwWrittenAt is a DWORD (32bits) thus it fails.... horribly... resulting in this segfault.

This patch fixes the issue..

--- ResourceEditor.h.64bit  2009-02-01 09:44:30.000000000 -0500
+++ ResourceEditor.h    2014-07-23 17:12:20.000000000 -0400
@@ -180,7 +180,7 @@

   void Destroy();

-  DWORD m_dwWrittenAt;
+  long m_dwWrittenAt;

 private:
   IMAGE_RESOURCE_DIRECTORY m_rdDir;
@@ -204,7 +204,7 @@

   CResourceDataEntry* GetDataEntry();

-  DWORD m_dwWrittenAt;
+  long m_dwWrittenAt;

 private:
   bool m_bHasName;
@@ -232,7 +232,7 @@
   DWORD GetCodePage();
   DWORD GetOffset();

-  DWORD m_dwWrittenAt;
+  long m_dwWrittenAt;

 private:
   BYTE* m_pbData;

I'm closing this, but leaving it out here as a knowledge-base entry. For now, please build on a non-RedHat (non-Fedora) system. Our current installers are built using Ubuntu which do not seem to suffer this bug.