[net.news.b] [read|v]news infinite loop

joe@fluke.UUCP (Joe Kelsey) (08/07/84)

Subject: [read|v]news infinite loop
Index:	rextern.c

Description:
	[read|v]news will go into an infinite loop after perusing a
	newsgroup in which ngsize > 8192.
Repeat-By:
	Find a machine which has been on the net for more than 
	~1.5 years.  Run [read|v]news -xn all.  Do an N command to
	get to unix-wizards.  Try to N somewhere from there.  Don't
	hold your breath.  For kicks, find another terminal and see
	which process happens to be near the top in CPU time.
Fix:
	In rextern.c, the array bitmap is defined:
	
	char	bitmap[1024], *argvrc[LINES];
	
	bitmap is used to store which articles in a group haven't been
	seen by you.  As an example of how bitmap is accessed, consider the
	following fragment from rfuncs.c:
	
		/* Zero out the bitmap */
	p = &bitmap[ngsize/8+1];
	for (ptr = bitmap; ptr <= p; ptr)
		*ptr++ = 0;
	
	Now, what if ngsize is greater than 8192?  What do you suppose
	happens to argvrc?  What do you think argvrc has anything to 
	do with?  Can you say "Lost in the ozone again"?  I thought
	you could!
	
	The obvious fix is to increase the size of bitmap.  Try 8192.
	That will let ngsize grow to 32767.  Thos of you with pdp11s
	may want to consider 2048 or 1536.
	
	The real fix is to change the bitmap so that it only maps the
	current range of articles by using another variable to hold the
	number of the lowest article, then consider the bits in bitmap
	to be numbered from the base rather than 0.  This would restrict 
	you to a maximum distance between articles of 8192, but that wouldn't
	be a major restriction.  However, I don't have the time right now to 
	do this, and anyway 2.10.2 is coming soon?  BTW, does 2.10.2 and/or
	2.11 use the same algorithm?

/Joe