bug in vn

roland at moncskermit.UUCP roland at moncskermit.UUCP
Wed Jan 28 13:38:02 AEST 1987


There is a bug? in vn which will lead to a floating point exception,
divide by 0. This occurs when reading an article where headers before
the "Lines:" extend over 1 line causing artlin to be 0.
The patch below will fix vn in this case to arbitrarily display 100% 
in the reader if artlin == 0.

Roland Yap	           ACSNET,CSNET:roland at moncskermit.oz	
Dept. of Computer Science  ARPA:roland%moncskermit.oz at seismo.arpa	
Monash University          UUCP: ..!seismo!munnari!moncskermit.oz!roland	
Clayton     		  ...!{decvax,pesnta,vax135}!mulga!moncskermit.oz!roland
Australia 3168
                          moncsbruce can also be substituted for moncskermit

-----------------< cut here and submit to patch >------------------------
*** oldreader.c	Wed Jan 28 14:11:59 1987
--- reader.c	Wed Jan 28 14:09:21 1987
***************
*** 201,207
  			*/
  			if (Headflag)
  				percent = ((Rlines-2)*100)/(artlin+Hlines);
! 			else
  				percent = ((Rlines-Hlines-2)*100)/artlin;
  			sprintf (pstr,PAGE_MID,percent);
  		}

--- 201,208 -----
  			*/
  			if (Headflag)
  				percent = ((Rlines-2)*100)/(artlin+Hlines);
! 			/*	Problem here in that gethead can return artlin=0 */
! 			else if (artlin > 0.0)
  				percent = ((Rlines-Hlines-2)*100)/artlin;
  			/*	fudge with arbitrary number	*/
  			else	percent = 100;
***************
*** 203,208
  				percent = ((Rlines-2)*100)/(artlin+Hlines);
  			else
  				percent = ((Rlines-Hlines-2)*100)/artlin;
  			sprintf (pstr,PAGE_MID,percent);
  		}
  		else

--- 204,211 -----
  			/*	Problem here in that gethead can return artlin=0 */
  			else if (artlin > 0.0)
  				percent = ((Rlines-Hlines-2)*100)/artlin;
+ 			/*	fudge with arbitrary number	*/
+ 			else	percent = 100;
  			sprintf (pstr,PAGE_MID,percent);
  		}
  		else



More information about the Comp.sources.bugs mailing list