#8 ✓resolved
Peter Johnson

Self-referencing equ's cause crashes

Reported by Peter Johnson | June 25th, 2011 @ 07:48 PM | in 0.2.0 (closed)

Originally posted on Trac by peter@tortall.net
Original Trac Ticket

  Description

  @@@

Symptom: the code

myself equ myself+1
jmp myself

from NASM's changed.asm test causes YASM to crash with a memory overflow.

Cause: expr_level_tree() expands equ's with no checking for recursive cases such
as the above. Solving this with the least performance hit is going to require
setting a "used" flag inside the symrec structure and maintaining a linked list
of seen symrecs. However, the latter alone may be an acceptable solution (with
a linear search instead of a flag check), as there will probably seldom be a
large number of symrecs used in a single expression and it's only an algorithmic
difference of O(1) vs. O(n) anyway.

Side note: NASM solves this by making the right side of an equ a critical
expression (must be defined before use). However, YASM is more flexible than
this, so we need to solve the problem in a different way.


  
h3. Trac Attachments

h3. Trac Comments
comment:1
    
                  
                  Changed 9 years ago by peter@tortall.net
  comment:1

              Changed 9 years ago by peter@tortall.net

  Status
    changed from new to assigned

  Status
    changed from new to assigned

comment:2
    
                  
                  Changed 9 years ago by peter@tortall.net
  I'll take this.

comment:3
    
                  
                  Changed 9 years ago by peter@tortall.net
  Fixed.

  comment:3

              Changed 9 years ago by peter@tortall.net

  Status
    changed from assigned to resolved

  Resolution
    set to fixed

  Fixed.

  Status
    changed from assigned to resolved

  Resolution
    set to fixed

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Yasm Modular Assembler Project

Shared Ticket Bins

People watching this ticket

Tags

Pages