Package: halibut
Version: 0.9+svn20050310-1
Severity: important
Tags: patch

I'm the maintainer of nsis, a package that uses an internal, modified
copy of halibut to generate some documentation. I recently got an nsis
package into the archive and received an FTBFS bug (303881), due to
donumber and doanumber in contents.c in halibut. These functions do
nasty things to some local variables, resulting in some segfaults during
building nsis on ppc/sparc/alpha/mipsel (and probly others). I note that
these to functions are the same in the nsis version of halibut as they
are in the debian version. I've attached a patch that I used to fix the
issue for powerpc. I really think this should get into sarge and be
pushed upstream, since halibut in debian is likely to be useless on
powerpc/sparc/alpha/mipsel and probably other platforms without it.

-- 
bye,
pabs
diff -urNad contents.c.orig contents.c
--- contents.c.orig	2005-04-12 00:19:08.000000000 +0800
+++ contents.c	2005-04-12 00:26:19.000000000 +0800
@@ -73,21 +73,21 @@
 static void donumber(word *** wret, int num)
 {
   wchar_t text[20];
-  wchar_t *p = text + sizeof(text);
-  *--p = L'\0';
+  int i = 19;
+  text[i] = L'\0';
   while (num != 0)
   {
-    assert(p > text);
-    *--p = L"0123456789"[num % 10];
+    assert(i >= 0);
+    i--; text[i] = L"0123456789"[num % 10];
     num /= 10;
   }
-  dotext(wret, p);
+  dotext(wret, &text[i]);
 }
 
 static void doanumber(word *** wret, int num)
 {
   wchar_t text[20];
-  wchar_t *p;
+  int i = 19;
   int nletters, aton;
   nletters = 1;
   aton = 25;
@@ -100,15 +100,14 @@
     else
       aton = INT_MAX;
   }
-  p = text + sizeof(text);
-  *--p = L'\0';
+  text[i] = L'\0';
   while (nletters--)
   {
-    assert(p > text);
-    *--p = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[num % 26];
+    assert(i >= 0);
+    i--; text[i] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[num % 26];
     num /= 26;
   }
-  dotext(wret, p);
+  dotext(wret, &text[i]);
 }
 
 void number_cfg(numberstate * state, paragraph * source)

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to