🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1498

Argument decoding bug in gnu make-3.38

#1498
From: Jonas Olsson
Date: Mon, 20 Feb 1989 13:11
47 lines
1780 bytes
make dumps core when values are omitted to flags e.g.:
make -j
Segmentation fault (dump saved in "core")

This occurs in the case where you have a flag with an optional numerical
argument as last argument on the command line. This only occurs on systems
that doesn't allow references of address zero (eg. Sun).

The fix is simple:


*** make.c.org	Mon Feb 20 12:46:24 1989
--- make.c	Mon Feb 20 13:00:15 1989
***************
*** 847,853 ****
  		    case positive_int:
  		      if (*sw == '\0')
  			sw = argv[++i];
! 		      if (isdigit (*sw))
  			{
  			  int i = atoi (sw);
  			  while (isdigit (*sw))
--- 847,853 ----
  		    case positive_int:
  		      if (*sw == '\0')
  			sw = argv[++i];
! 		      if (sw && isdigit (*sw))
  			{
  			  int i = atoi (sw);
  			  while (isdigit (*sw))
***************
*** 888,894 ****
  		    case floating:
  		      if (*sw == '\0')
  			sw = argv[++i];
! 		      if (*sw == '.' || isdigit (*sw))
  			{
  			  *(double *) cs->value_ptr = atof (sw);
  			  while (*sw == '.' || isdigit (*sw))
--- 888,894 ----
  		    case floating:
  		      if (*sw == '\0')
  			sw = argv[++i];
! 		      if (sw && (*sw == '.' || isdigit (*sw)))
  			{
  			  *(double *) cs->value_ptr = atof (sw);
  			  while (*sw == '.' || isdigit (*sw))
Technical Details
Message-ID: <8902201222.AA12455@sisug.sisu.se>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!sisug.sisu.se!jonas

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!sisug.sisu.se!jonas
From: jonas@sisug.sisu.se (Jonas Olsson)
Newsgroups: gnu.utils.bug
Subject: Argument decoding bug in gnu make-3.38
Message-ID: <8902201222.AA12455@sisug.sisu.se>
Date: 20 Feb 89 13:11:46 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 47
X-Unparsable-Date: Mon, 20 Feb 89 13:22:32 MET DST