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

Bug#613642: bus error in ps2pdf



tag 613642 patch
kthxbye

On Wed, Feb 16, 2011 at 13:56:52 +0100, Julien Cristau wrote:

> gx_semaphore_alloc() allocates a 8-byte-aligned gx_semaphore_t, which
> means that sema->native is *not* 8-byte-aligned (its offset is 4),
> whereas alignof(pt_semaphore_t) == 8.  The easiest fix is probably to
> make sure gp_semaphore has maximal alignment.
> 
Quick test with the following patch seems to work (using Stéphane's test
case).

--- ghostscript-9.01~dfsg.orig/base/gpsync.h
+++ ghostscript-9.01~dfsg/base/gpsync.h
@@ -28,8 +28,11 @@
  * control to proceed iff the number of signals since semaphore creation
  * is greater than the number of waits.
  */
-typedef struct {
-    void *dummy_;
+/* Needs to have maximum alignment */
+typedef union {
+    void *dummy1;
+    double dummy2;
+    long dummy3;
 } gp_semaphore;
 
 uint gp_semaphore_sizeof(void);

Cheers,
Julien



Reply to: