#83 ✓resolved
Peter Johnson

Preprocessor: Declaring an instance of a structure crashes the yasm executable

Reported by Peter Johnson | June 25th, 2011 @ 07:49 PM

Originally posted on Trac by dnegrescu@hotmail.com
Original Trac Ticket

  Description

The following code (straight from the NASM manual) makes the yasm executable to crash with "Integer division by zero" exception. This happens with version 0.5.0 as well as with the latest snapshots (I've tried r1655, r1653 and r1642).

struc mytype

.long: resd 1 .word: resw 1 .byte: resb 1 .str: resb 32

endstruc

mystruc:

istruc mytype

at mytype.long, dd 123456
at mytype.word, dw 1024
at mytype.byte, db 'x'
at mytype.str, db 'hello, world', 13, 10, 0

iend

h3. Trac Attachments
http://www.tortall.net:80//projects/yasm/attachment/ticket/85/YasmS...
http://www.tortall.net:80//projects/yasm/raw-attachment/ticket/85/Y...
http://www.tortall.net:80//projects/yasm/timeline?from=2006-10-19T0...
h3. Trac Comments
comment:1

              Changed 5 years ago by peter@tortall.net


I can't reproduce this on either Unix or Windows copying-and-pasting the above into a file.  What platform?  Are you compiling yasm yourself or downloading the Windows executable?  Is this really the entire test code?  Maybe attach a file?

Changed 5 years ago by dnegrescu@hotmail.com



This file makes yasm to crash (with divide by zero exception) when the -l command line switch is used

                  Changed 5 years ago by dnegrescu@hotmail.com

      attachment
        YasmStrucBug.asm​
          added

This file makes yasm to crash (with divide by zero exception) when the -l command line switch is used

      attachment
        YasmStrucBug.asm​
          added

comment:2

              Changed 5 years ago by dnegrescu@hotmail.com


I've attached the test file. I'm using the Windows (32 bit) binaries that I downloaded from the yasm project site. I did more testing with this and it appears that the crash occurs only when the ‘listfile’ (-l) switch is used. This is the command line that will generate the error:

yasm-0.5.0-win32.exe -f win32 -l bug.lst YasmStrucBug?.asm

comment:3

              Changed 5 years ago by peter


(In [1658]) Fix #85: Multiple may be 0.  In this case, force size to zero instead of
dividing (and thus crashing).

      comment:3

                  Changed 5 years ago by peter

      Status
        changed from new to closed
    
      Resolution
        set to fixed

(In [1658]) Fix #85: Multiple may be 0.  In this case, force size to zero instead of
dividing (and thus crashing).

      Status
        changed from new to closed
    
      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

Pages