[444] in testers

home help back first fref pref prev next nref lref last post

rt 6.4A: expunge

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Sun Dec 10 15:59:32 1989

Date: Sun, 10 Dec 89 15:59:04 -0500
From: Jonathan I. Kamens <jik@PIT-MANAGER.MIT.EDU>
To: testers@ATHENA.MIT.EDU
System name:		pit-manager
Type and version:	RTPC-ROMPC 6.4A
Display type:		apa16
			megapel

What were you trying to do?
	expunge INTERN.h Pnews.1 all makedepend.SH

	The above four files all exist in the current working
	directory in deleted (".#" prefix) form.

What's wrong:
	Expunge core dumps.  (segmentation violation)

What should have happened:
	It should not have coredumped.

Please describe any relevant documentation references:
	The patch included at the end of this message will fix the
	problem.  Can you say "boundary condition"?  I knew you could.

Importance of patch:
	Minimal.  This bug will not do anything nasty like delete
	people's files when they don't expect it or anything like
	that.  It will simply cause a coredump.  It will also happen
	*very* infrequently.  But I managed to run into it and repeat
	it, so here's the fix.

*** /tmp/,RCSt1015604	Sun Dec 10 15:58:40 1989
--- stack.c	Sun Dec 10 15:45:54 1989
***************
*** 11,17 ****
   */
  
  #if (!defined(lint) && !defined(SABER))
!      static char rcsid_stack_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/stack.c,v 1.3 89/11/22 21:26:27 jik Exp $";
  #endif
  
  #include <sys/types.h>
--- 11,17 ----
   */
  
  #if (!defined(lint) && !defined(SABER))
!      static char rcsid_stack_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/stack.c,v 1.4 89/12/10 15:45:31 jik Exp $";
  #endif
  
  #include <sys/types.h>
***************
*** 46,55 ****
  	  }
  	  return 0;
       case STACK_PUSH:
  	  if (size - count < bytes) {
! 	       size += size - count + bytes;
! 	       if (size % STACK_INC)
! 		    size += STACK_INC - size % STACK_INC;
  	       stack = (caddr_t) (stack ? realloc((char *) stack,
  						  (unsigned) size) :
  				  Malloc((unsigned) size));
--- 46,57 ----
  	  }
  	  return 0;
       case STACK_PUSH:
+ 	  if (bytes == 0)
+ 	       return 0;
  	  if (size - count < bytes) {
! 	       do
! 		    size += STACK_INC;
! 	       while (size - count < bytes);
  	       stack = (caddr_t) (stack ? realloc((char *) stack,
  						  (unsigned) size) :
  				  Malloc((unsigned) size));
***************
*** 64,69 ****
--- 66,73 ----
  	  count += bytes;
  	  return 0;
       case STACK_POP:
+ 	  if (bytes == 0)
+ 	       return 0;
  	  if (count == 0) {
  	       set_status(STACK_EMPTY);
  	       return error_code;

home help back first fref pref prev next nref lref last post