Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 May 2002 20:45:50 +0200 (CEST)
From:      Philipp Mergenthaler <philipp.mergenthaler@stud.uni-karlsruhe.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   misc/37755: [PATCH] Small bug in loader's forth interpreter
Message-ID:  <200205041845.g44IjoRj000682@i609a.hadiko.de>

next in thread | raw e-mail | index | archive | help

>Number:         37755
>Category:       misc
>Synopsis:       [PATCH] Small bug in loader's forth interpreter
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 04 11:50:01 PDT 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205041845.g44IjoRj000682>