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

Bug#390875: gs-gpl: patch to make qsort call in src/gxfcopy.c 64-bit clean



tags 390875 +patch
thanks

Hello,

the attached patch changes the qsort function call in src/gxfcopy.c
so that it becomes 64-bit clean. 

Without this patch, the code segfaults when qsort calls the
compare_glyph_names function because sizeof(int) == 4 but 
sizeof(gs_copied_glyph_name_t*) == 8 on most 64-bit architectures.

Many packages in unstable currently FTBFS on 64-bit architectures
during documentation generation because of this bug.

Regards
Andreas Jochens

diff -urN ../tmp-orig/gs-gpl-8.54.dfsg.1/src/gxfcopy.c ./src/gxfcopy.c
--- ../tmp-orig/gs-gpl-8.54.dfsg.1/src/gxfcopy.c	2006-03-23 12:39:23.000000000 +0000
+++ ./src/gxfcopy.c	2006-10-11 08:18:45.000000000 +0000
@@ -2391,7 +2391,7 @@
 	    a[j++] = &cfdata->names[i];
 	}
     }
-    qsort(a, cfdata->num_glyphs, sizeof(int), compare_glyph_names);
+    qsort(a, cfdata->num_glyphs, sizeof(gs_copied_glyph_name_t*), compare_glyph_names);
     for (; j >= 0; j--)
 	cfdata->glyphs[j].order_index = a[j] - cfdata->names;    
     gs_free_object(memory, a, "order_font_data");




Reply to: