Fix SIGSEGV while compiling dthelp on 64 bit systems.
authorJon Trulson <jon@radscan.com>
Tue, 7 Aug 2012 04:42:34 +0000 (22:42 -0600)
committerJon Trulson <jon@radscan.com>
Tue, 7 Aug 2012 04:42:34 +0000 (22:42 -0600)
Patch from Ulrich Wilkens <mail@uwilkens.de>

I have a little patch for a problem that I found when I tried to
compile dthelp on 64bit FreeBSD. It could also be a problem on other
64bit systems.  The problem is that the program context compiles but
fails running with segmentation fault.

context uses the function m_malloc() which is missing a correct
prototype sometimes. Then it's treated to return int instead of void *
. On 64bit systems this cuts off the higher 32 bits because void * is
64bit whereas int is only 32bit.

cde/programs/dthelp/parser.ccdf/htag/util/basic.h
cde/programs/dthelp/parser/canon1/util/basic.h
cde/programs/dthelp/parser/pass1/util/basic.h
cde/programs/dthelp/parser/pass2/util/basic.h

index 5e5580eca10ff4ff565a5e5bf5dcffa69620ddab..223b30a1b34d7ef140c518ced5e8afca769a71b3 100644 (file)
@@ -106,3 +106,9 @@ M_WCHAR *w_strstr(
   M_WCHAR *string1, M_WCHAR *string2
 #endif
   );
+
+void *m_malloc(
+#if defined(M_PROTO)
+  int size, char *msg
+#endif
+  ) ;
index b1b2d775d426b572ae6dc121d9e8bd4bfc28ce64..f505123ba9a5ef4009111b20c4ccd4e235fa33ca 100644 (file)
@@ -106,3 +106,9 @@ M_WCHAR *w_strstr(
   M_WCHAR *string1, M_WCHAR *string2
 #endif
   );
+
+void *m_malloc(
+#if defined(M_PROTO)
+  int size, char *msg
+#endif
+) ;
index dc410050336192dddf0f0b26385d34ff83b6e996..301422a5ec7b5a650ff2e658e9f1939d1fdb3e62 100644 (file)
@@ -106,3 +106,9 @@ M_WCHAR *w_strstr(
   M_WCHAR *string1, M_WCHAR *string2
 #endif
   );
+
+void *m_malloc(
+#if defined(M_PROTO)
+  int size, char *msg
+#endif
+  ) ;
index 31755a18dcb8736443b3f664a4e2dad522414059..38c93edcdcfd3e5de8a6bd6be4a1f921133974ff 100644 (file)
@@ -112,3 +112,9 @@ M_WCHAR *w_strstr(
   M_WCHAR *string1, M_WCHAR *string2
 #endif
   );
+
+void *m_malloc(
+#if defined(M_PROTO)
+  int size, char *msg
+#endif
+  ) ;