🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.ghostscript.bug
Article #45

bugfix for core dump in scanner (version 1.3)

#45
From: Snoopy
Date: Tue, 27 Jun 1989 05:04
46 lines
1749 bytes
There is a bug in the version 1.3 scanner.  If a fractional number
is given without a digit to the left of the decimal point a double
variable is used before being set, causing a core dump.

Repeat by:

GS> 0.123		% works fine
GS>  .123		% core dumps

Fix: initialize the variable 'dval' to 0.0

RCS file: RCS/iscan.c,v
Retrieving revision 1.2
diff  -c -r1.2 iscan.c
*** /tmp/,RCSt1001206	Mon Jun 26 21:48:44 1989
--- iscan.c	Mon Jun 26 21:28:10 1989
***************
*** 340,345
  	double dval;
  	int code;
  	register int c;
  	switch ( c = sgetc(s) )
  	   {
  	case '+': sign = 1; c = sgetc(s); break;

--- 340,346 -----
  	double dval;
  	int code;
  	register int c;
+ 	dval = 0.0; /* initializing dval before use avoids core dumps -Snoopy */
  	switch ( c = sgetc(s) )
  	   {
  	case '+': sign = 1; c = sgetc(s); break;
***************

If you're wondering, the difference between RCS versions 1.1 and 1.2
is the removal of the trailing control-m chars.

    _____     						  .-----.
   /_____\    Snoopy					./  RIP	 \.
  /_______\   qiclab!sopwith!snoopy			|  	  |
    |___|     parsely!sopwith!snoopy			| tekecs  |
    |___|     sun!nosun!illian!sopwith!snoopy		|_________|

	I ain't 'fraid ah no Ghostscript bug!
Technical Details
Message-ID: <228@sopwith.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!zephyr!tektronix!psueea!qiclab!sopwith!snoopy

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!zephyr!tektronix!psueea!qiclab!sopwith!snoopy
From: snoopy@sopwith.UUCP (Snoopy)
Newsgroups: gnu.ghostscript.bug
Subject: bugfix for core dump in scanner (version 1.3)
Keywords: Ghostscript 1.3  core dump  scanner  bugfix
Message-ID: <228@sopwith.UUCP>
Date: 27 Jun 89 05:04:31 GMT
Reply-To: snoopy@sopwith.UUCP (Snoopy)
Distribution: gnu
Organization: The Daisy Hill Puppy Farm
Lines: 46