Article View: net.sources.bugs
Article #923bug in vn
From: roland
Date: Wed, 28 Jan 1987 03:38
Date: Wed, 28 Jan 1987 03:38
53 lines
2282 bytes
2282 bytes
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@moncskermit.oz
Dept. of Computer Science ARPA:roland%moncskermit.oz@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
Technical Details
Message-ID:
<411@moncskermit.oz>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!seismo!munnari!moncskermit!rolandShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!seismo!munnari!moncskermit!roland From: roland@moncskermit.UUCP Newsgroups: net.sources.bugs Subject: bug in vn Message-ID: <411@moncskermit.oz> Date: Tue, 27-Jan-87 22:38:02 EST Article-I.D.: moncsker.411 Posted: Tue Jan 27 22:38:02 1987 Date-Received: Tue, 3-Feb-87 19:21:59 EST Organization: Comp Sci, Monash Uni, Australia Lines: 53 Keywords: vn