bugGforth - Bugs: bug #52085, Invalid memory address error in...

 
 

bug #52085: Invalid memory address error in valid code. Equivalent code has no error.

Submitted by:  Colton Lewis <cwlmb3>
Submitted on:  Fri 22 Sep 2017 05:58:41 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Invalid
Privacy: PublicAssigned to: Anton Ertl <anton>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 01 Oct 2017 11:08:59 AM UTC, comment #1:

I could reproduce the problem. This is a bug in rin.fth (also in rin2.fth and rin3.fth, but there the bug does not lead to a crash). The problem is that PAD points to a little behind HERE, and code is compiled at HERE, moving HERE and PAD, but not the former PAD stored in IO. What happens in rin.fth is that the READ-FILE overwrites the ";S" compiled by the ";" in RIN. You can check by doing a SIMPLE-SEE RIN before and after the call to RIN.

Fix: Use the address returned by PAD directly. It is only valid until HERE changes (e.g., by compilation, ALLOT, or ",").

Anton Ertl <anton>
Project AdministratorIn charge of this item.
Fri 22 Sep 2017 05:58:41 AM UTC, original submission:

Version: 0.7.3
Compiler: gcc 5.4.0
OS: Gnu/Linux

Steps to reproduce:
1. Download the attached source files.
2. Populate a file named "file" with some text. (echo gforth >file)
3. Execute rin.fth (gforth rin.fth)
4. Note the code fails with "rin.fth:9: Invalid memory address".
5. Repeat step 3 with files rin2.fth and rin3.fth, which both succeed, leaving bytes read on the stack as expected.

Colton Lewis <cwlmb3>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #41865:  rin.fth added by cwlmb3 (160B - application/octet-stream)
file #41866:  rin3.fth added by cwlmb3 (160B - application/octet-stream)
file #41867:  rin2.fth added by cwlmb3 (159B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by anton (Posted a comment)
  • -unavailable- added by cwlmb3 (Submitted the item)
  • -unavailable- added by cwlmb3
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 01 Oct 2017 11:08:59 AM UTCantonStatusNone=>Invalid
      Assigned toNone=>anton
      Open/ClosedOpen=>Closed
    Fri 22 Sep 2017 05:58:41 AM UTCcwlmb3Attached File-=>Added rin.fth, #41865
      Attached File-=>Added rin3.fth, #41866
      Attached File-=>Added rin2.fth, #41867
      Carbon-Copy-=>Added cwlmb3

    Back to the top


    Powered by Savane 3.1-cleanup1