flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [BUG] Stack overflow

Author
Thread Post new topic Reply to topic
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Compiling the following code twice (re-opening the source first), will produce a stack overflow situation (not stack buffer overflow):
Code:
format binary as 'asm' ; Self destructible source :D

repeat 1000000
  ; db "(" ; This will make FASMW crash
  db "-" ; This crash FASMW and command line fasm
end repeat    


[edit]Command line version also silently crash when "-" is used. I've changed the code to test for that and commented the "(" test.[/edit]


Last edited by LocoDelAssembly on 30 Aug 2009, 18:38; edited 1 time in total
Post 30 Aug 2009, 17:33
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17349
Location: In your JS exploiting you and your system
revolution
fasm (command line version) is fine with that above code (I get 'error: out of stack space.')

At 100000000 I only get 'error: out of memory.'

At 1000 I get 'error: illegal instruction'
Post 30 Aug 2009, 17:45
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Quote:

fasm (command line version) is fine with that above code (I get 'error: out of stack space.')
Yep, I almost posted this on Compilers Internals but after verifying this I posted here. Smile

BTW, that is just minimal example, but actually the same will happen if a very long chain of "(" or "-" is found in any expression.
Post 30 Aug 2009, 18:29
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
Is this really a bug, or simply because of too deep recursion? Confused
Post 01 Sep 2009, 18:30
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7737
Location: Kraków, Poland
Tomasz Grysztar
It is a bug, because fasm should display "out of stack space" error in all cases.
Post 01 Sep 2009, 18:34
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.