Subject: as(1) dumps core after error in pass 2 (#384)
Index:	bin/as2.s 2.11BSD

Description:
	The assembler as(1) will dump core under certain error conditions
	after printing out an incorrect error.

Repeat-By:

	echo "sys 112 ." | as -o foo.o
-
d 0001
Segmentation fault (core dumped)

Fix:
	Note the illegal syntax - there is a space which should not be present
	after 112.  The assembler then sees '.' and an illegal attempt to do
	something with the current location counter.  An 'a' (addressing) error
	should be produced instead of the 'd' error (there is no such error in
	as(1)) and no core dump should occur.

	The problem was one of overlooking 3 error reporting calls when the
	assembler was converted from two separate programs (/bin/as & /lib/as2).
	Pass 1 of the assembler uses a different calling convention than pass 2
	when reporting errors.  The core dump was due to pass 2 using the first
	pass's error convention.

	The fix is small.  Cut where indicated, saving to a file (/tmp/384)
	and then:

		patch -p0 < /tmp/384
		cd /usr/src/bin/as
		make
		make install
		make clean

	As always this and previous updates to 2.11BSD are available via
	anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the
	directory /pub/2.11BSD.

-------------------------cut here----------------------
*** /usr/src/bin/as/as2.s.old	Wed Sep 15 19:24:58 1993
--- /usr/src/bin/as/as2.s	Wed Sep 10 22:38:32 1997
***************
*** 1,3 ****
--- 1,6 ----
+ / Sept 10, 1997 - fix coredump caused by using wrong error reporting
+ /	calling convention in three places.
+ 
  	.globl	_signal, _close, _lseek, _unlink, _umask, _chmod, __exit
  	.globl	_write, _read, _brk, _end, _open, _creat, _realloc, _fchmod
  	.globl	pass1, hshsiz, outmod, dot, dotdot, error
***************
*** 4,10 ****
  	.globl	checkeos, curfb, savdot, ch, line, savop, inbuf, errflg
  	.globl	fbptr, fbtbl, symnum, hshtab, symblk, symleft, dotrel
  	.globl	symtab, aexit, overlaid, defund, a.outp, passno, filerr
! 	.globl	wrterr, argb, errore, errora, curfb, nxtfb, usymtab
  	.globl	fin, fout, a.tmp1, ibufc, ibufp, obufp, outbuf, symbol
  	.globl	PSTENTSZ, SYMENTSZ, SYMBLKSZ, Newsym
  
--- 7,13 ----
  	.globl	checkeos, curfb, savdot, ch, line, savop, inbuf, errflg
  	.globl	fbptr, fbtbl, symnum, hshtab, symblk, symleft, dotrel
  	.globl	symtab, aexit, overlaid, defund, a.outp, passno, filerr
! 	.globl	wrterr, argb, curfb, nxtfb, usymtab
  	.globl	fin, fout, a.tmp1, ibufc, ibufp, obufp, outbuf, symbol
  	.globl	PSTENTSZ, SYMENTSZ, SYMBLKSZ, Newsym
  
***************
*** 1117,1123 ****
  	cmp	r3,$1
  	ble	1f
  0:
! 	jsr	pc,errora
  1:
  	bis	(sp)+,r2
  	jsr	pc,outw
--- 1120,1127 ----
  	cmp	r3,$1
  	ble	1f
  0:
! 	mov	$'a,-(sp)
! 	jsr	pc,error
  1:
  	bis	(sp)+,r2
  	jsr	pc,outw
***************
*** 1355,1361 ****
  2:
  	rts	pc
  1:
! 	jsr	pc,errora
  	clr	r2
  	clr	r3
  	rts	pc
--- 1359,1366 ----
  2:
  	rts	pc
  1:
! 	mov	$'a,-(sp)
! 	jsr	pc,error
  	clr	r2
  	clr	r3
  	rts	pc
***************
*** 1502,1508 ****
  binop:
  	cmpb	(sp),$'+
  	beq	1f
! 	jsr	pc,errore
  1:
  	movb	r4,(sp)
  	br	advanc
--- 1507,1514 ----
  binop:
  	cmpb	(sp),$'+
  	beq	1f
! 	mov	$'e,-(sp)
! 	jsr	pc,error
  1:
  	movb	r4,(sp)
  	br	advanc
*** /VERSION.old	Mon Aug 11 21:20:47 1997
--- /VERSION	Thu Sep 11 19:31:02 1997
***************
*** 1,5 ****
! Current Patch Level: 383
! Date: August 11, 1997
  
  2.11 BSD
  ============
--- 1,5 ----
! Current Patch Level: 384
! Date: September 10, 1997
  
  2.11 BSD
  ============
