Hello,

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.


Here's the patch:

diff --git a/cde/programs/dthelp/parser.ccdf/htag/util/basic.h b/cde/programs/dthelp/parser.ccdf/htag/util/basic.h
index 5e5580e..223b30a 100644
--- a/cde/programs/dthelp/parser.ccdf/htag/util/basic.h
+++ b/cde/programs/dthelp/parser.ccdf/htag/util/basic.h
@@ -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
+  ) ;
diff --git a/cde/programs/dthelp/parser/canon1/util/basic.h b/cde/programs/dthelp/parser/canon1/util/basic.h
index b1b2d77..f505123 100644
--- a/cde/programs/dthelp/parser/canon1/util/basic.h
+++ b/cde/programs/dthelp/parser/canon1/util/basic.h
@@ -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
+) ;
diff --git a/cde/programs/dthelp/parser/pass1/util/basic.h b/cde/programs/dthelp/parser/pass1/util/basic.h
index dc41005..301422a 100644
--- a/cde/programs/dthelp/parser/pass1/util/basic.h
+++ b/cde/programs/dthelp/parser/pass1/util/basic.h
@@ -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
+  ) ;
diff --git a/cde/programs/dthelp/parser/pass2/util/basic.h b/cde/programs/dthelp/parser/pass2/util/basic.h
index 31755a1..38c93ed 100644
--- a/cde/programs/dthelp/parser/pass2/util/basic.h
+++ b/cde/programs/dthelp/parser/pass2/util/basic.h
@@ -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
+  ) ;


diff --git a/cde/programs/dthelp/parser.ccdf/htag/util/basic.h 
b/cde/programs/dthelp/parser.ccdf/htag/util/basic.h
index 5e5580e..223b30a 100644
--- a/cde/programs/dthelp/parser.ccdf/htag/util/basic.h
+++ b/cde/programs/dthelp/parser.ccdf/htag/util/basic.h
@@ -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
+  ) ;
diff --git a/cde/programs/dthelp/parser/canon1/util/basic.h 
b/cde/programs/dthelp/parser/canon1/util/basic.h
index b1b2d77..f505123 100644
--- a/cde/programs/dthelp/parser/canon1/util/basic.h
+++ b/cde/programs/dthelp/parser/canon1/util/basic.h
@@ -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
+) ;
diff --git a/cde/programs/dthelp/parser/pass1/util/basic.h 
b/cde/programs/dthelp/parser/pass1/util/basic.h
index dc41005..301422a 100644
--- a/cde/programs/dthelp/parser/pass1/util/basic.h
+++ b/cde/programs/dthelp/parser/pass1/util/basic.h
@@ -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
+  ) ;
diff --git a/cde/programs/dthelp/parser/pass2/util/basic.h 
b/cde/programs/dthelp/parser/pass2/util/basic.h
index 31755a1..38c93ed 100644
--- a/cde/programs/dthelp/parser/pass2/util/basic.h
+++ b/cde/programs/dthelp/parser/pass2/util/basic.h
@@ -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
+  ) ;
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to