DragonFly BSD
DragonFly bugs List (threaded) for 2004-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: /usr/bin/dc hangs


From: Paul Herman <pherman@xxxxxxxxxxxxxxx>
Date: Fri, 19 Nov 2004 21:55:55 -0800 (PST)

On Thu, 18 Nov 2004, Paul Herman wrote:

Just saw this:

  bash$ echo "e(1.9)" | bc -l
  6.68589444227926941607
  bash$ echo "e(2.0)" | bc -l
  7.38905609893065022723
  bash$ echo "e(2.1)" | bc -l
  [...]

...and dc (that's with a 'd') just hangs consuming 100% of CPU. Seems to be true for any number > 2.0. The older bc/dc work. Tried gcc2 and gcc34, same results.

I just heard back from otto (the author) and he says this is a bug in OpenSSL. Here's the patch he forwarded to me.


-Paul.

Index: bn_word.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/bn/bn_word.c,v
retrieving revision 1.5
retrieving revision 1.7
diff -u -p -r1.5 -r1.7
--- bn_word.c	12 May 2003 02:18:36 -0000	1.5
+++ bn_word.c	25 Sep 2003 19:55:36 -0000	1.7
@@ -110,6 +110,9 @@ int BN_add_word(BIGNUM *a, BN_ULONG w)
 	BN_ULONG l;
 	int i;

+	if ((w & BN_MASK2) == 0)
+		return(1);
+
 	if (a->neg)
 		{
 		a->neg=0;
@@ -142,6 +145,9 @@ int BN_add_word(BIGNUM *a, BN_ULONG w)
 int BN_sub_word(BIGNUM *a, BN_ULONG w)
 	{
 	int i;
+
+	if ((w & BN_MASK2) == 0)
+		return(1);

 	if (BN_is_zero(a) || a->neg)
 		{



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