🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.soft-sys.andrew
Article #2150

Amazing AMS bug

#2150
From: Nathaniel Borenstein
Date: Thu, 01 Mar 1990 19:01
27 lines
1712 bytes
A first-time AMS user here at Bellcore just stumbled on a core-dumping
AMS bug that has, as far as I can tell lurked undiscovered for several
years in code that is executed many thousands of times each day (the
fact that it has never been stumbled on before is the amazing part). 
The fix is trivial -- it is on line 85 of ams/libs/ms/bldpvmap.c.  The
old version is:

		while (PreorderSubscriptionStrcmp(SubsInPathOrder[subsindex]->key,
name) < 0 && subsindex < NumSubsInUse &&
SubsInPathOrder[subsindex]->pathelt == pathindex) {

The fixed version is:

		while (subsindex < NumSubsInUse &&
PreorderSubscriptionStrcmp(SubsInPathOrder[subsindex]->key, name) < 0 
&& SubsInPathOrder[subsindex]->pathelt == pathindex) {

In other words, all that changes is that the first and second test in
the while loop are exchanged.  This is necessary because if subsindex is
greater than or equal to NumSubsInUse, the current first test will be
indexing out of the bounds of the array; apparently this is usually
harmless, but in our current case it produces core dumps very quickly
(dereferencing a NULL pointer.)

This would probably be a good thing to put in a future patch.  By the
way, the symptom of this bug is that Messages dies on "expose all" and
cui dies on "list".    Cheers.  -- Nathaniel
Technical Details
Message-ID: <sZvL5vC0M2Yt4ddxoj@thumper.bellcore.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!THUMPER.BELLCORE.COM!nsb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!THUMPER.BELLCORE.COM!nsb
From: nsb@THUMPER.BELLCORE.COM (Nathaniel Borenstein)
Newsgroups: comp.soft-sys.andrew
Subject: Amazing AMS bug
Message-ID: <sZvL5vC0M2Yt4ddxoj@thumper.bellcore.com>
Date: 1 Mar 90 19:01:15 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 27