From p@i609a.hadiko.de  Sat May  4 11:45:54 2002
Return-Path: <p@i609a.hadiko.de>
Received: from mailgate.rz.uni-karlsruhe.de (mailgate.rz.uni-karlsruhe.de [129.13.64.97])
	by hub.freebsd.org (Postfix) with ESMTP id B509237B419
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  4 May 2002 11:45:52 -0700 (PDT)
Received: from nce2.hadiko.de (hadince2.hadiko.uni-karlsruhe.de [172.20.32.2])
	by mailgate.rz.uni-karlsruhe.de with esmtp (Exim 3.33 #1)
	id 1744XX-0004mh-00; Sat, 04 May 2002 20:45:51 +0200
Received: from i609a.hadiko.de (hadii609a.hadiko.uni-karlsruhe.de [172.20.49.159])
	by nce2.hadiko.de (8.11.3/8.11.3) with ESMTP id g44Ijoc05119
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 4 May 2002 20:45:50 +0200 (MET DST)
Received: from i609a.hadiko.de (localhost [127.0.0.1])
	by i609a.hadiko.de (8.12.3/8.12.3) with ESMTP id g44IjoUY000683
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 4 May 2002 20:45:50 +0200 (CEST)
	(envelope-from p@i609a.hadiko.de)
Received: (from p@localhost)
	by i609a.hadiko.de (8.12.3/8.12.3/Submit) id g44IjoRj000682;
	Sat, 4 May 2002 20:45:50 +0200 (CEST)
Message-Id: <200205041845.g44IjoRj000682@i609a.hadiko.de>
Date: Sat, 4 May 2002 20:45:50 +0200 (CEST)
From: Philipp Mergenthaler <philipp.mergenthaler@stud.uni-karlsruhe.de>
Reply-To: Philipp Mergenthaler <philipp.mergenthaler@stud.uni-karlsruhe.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] Small bug in loader's forth interpreter
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         37755
>Category:       misc
>Synopsis:       [PATCH] Small bug in loader's forth interpreter
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dcs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 04 11:50:01 PDT 2002
>Closed-Date:    Sun May 05 20:22:08 PDT 2002
>Last-Modified:  Sun May 05 20:22:08 PDT 2002
>Originator:     Philipp Mergenthaler
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
University of Karlsruhe
>Environment:
System: FreeBSD i609a.hadiko.de 5.0-CURRENT FreeBSD 5.0-CURRENT #533: Sat Apr 27 19:14:25 CEST 2002 p@i609a.hadiko.de:/usr/src/sys/i386/compile/I609 i386


>Description:

Loader's forth interpreter has a bug regarding the command s" in interactive
mode: when it copies the string into a scratch area it doesn't mark
that area as used. Therefor a following s" command will overwrite the
first string. (In compiled mode this works correctly.)

>How-To-Repeat:

At the loader's prompt, enter several s" commands and note that all strings
are copied to the same address:

OK s" foo" s" bar" . . . .
3 295013 3 295013 OK

>Fix:

Allocate the necessary space in stringQuoteIm().  This is analogous to
cstringQuoteIm().


Index: words.c
===================================================================
RCS file: /ncvs/src/sys/boot/ficl/words.c,v
retrieving revision 1.37
diff -u -r1.37 words.c
--- words.c	9 Apr 2002 17:45:11 -0000	1.37
+++ words.c	4 May 2002 17:07:59 -0000
@@ -3231,6 +3231,8 @@
         vmGetString(pVM, sp, '\"');
         PUSHPTR(sp->text);
         PUSHUNS(sp->count);
+		/* move HERE past string so it doesn't get overwritten. */
+		dictAllot(dp, sp->count + sizeof(FICL_COUNT));
     }
     else    /* COMPILE state */
     {

>Release-Note:
>Audit-Trail:

From: Philipp Mergenthaler <un1i@rz.uni-karlsruhe.de>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: misc/37755: [PATCH] Small bug in loader's forth interpreter
Date: Sun, 5 May 2002 21:00:35 +0200

 This PR can be closed.
 Repeated uses of s" may indeed overwrite the temporary buffer, according
 to ANS Forth: http://ficl.sourceforge.net/dpans/dpans11.htm#11.6.1.2165
 
 Sorry for wasting time,
 Philipp
State-Changed-From-To: open->closed 
State-Changed-By: johan 
State-Changed-When: Sun May 5 20:20:55 PDT 2002 
State-Changed-Why:  
Closed at origs request. 


Responsible-Changed-From-To: freebsd-bugs->dcs 
Responsible-Changed-By: johan 
Responsible-Changed-When: Sun May 5 20:20:55 PDT 2002 
Responsible-Changed-Why:  
Over to forth/ficl mainainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=37755 
>Unformatted:
