flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [bug][Solved in FASM 1.71.16] invalid ELF file generated

Author
Thread Post new topic Reply to topic
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 29 Oct 2013, 21:41
Hi, Tomasz.

It is very old problem, that I get from time to time invalid ELF file generated.

The sources where this happened were pretty big and it was impossible to search the reasons for such strange behavior.

Fortunately, today I managed to construct very small source, where the bug appears and can be reproduced. The example is artificial and does not compile to valid program:
Code:
        format ELF executable 3
        entry start

        segment readable writeable executable
start:
        int3

        align 4   ; comment this line in order to get valid elf.
        rb  16

        segment interpreter readable
        db '******************', 0

        segment dynamic readable
        db 8 dup('.')

        segment readable writeable
        db 8 dup '?'    


The source is compiled to ELF file with size 197 bytes, where the asterisk string '******************',0 misses at all.

After commenting out the 'align 4' directive, the source compiles to ELF file with size 216 bytes (!) where the mentioned string exists.

_________________
Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9


Last edited by JohnFound on 30 Oct 2013, 12:46; edited 2 times in total
Post 29 Oct 2013, 21:41
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 29 Oct 2013, 22:24
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 19:15; edited 1 time in total
Post 29 Oct 2013, 22:24
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20344
Location: In your JS exploiting you and your system
revolution 30 Oct 2013, 01:27
Confirmed. I made it sticky.
Post 30 Oct 2013, 01:27
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8354
Location: Kraków, Poland
Tomasz Grysztar 30 Oct 2013, 11:26
While testing the fix for this problem I have also found another bug - one that made the addresses to be generated incorrectly if you used the default segment (that is: start code right away after "format ELF executable", without a segment directive). I fixed them both. Please try 1.71.16.
Post 30 Oct 2013, 11:26
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 30 Oct 2013, 12:18
Everything seems to be OK now. Two bugs less in FASM - one more step towards the perfect assembler. Smile
Post 30 Oct 2013, 12:18
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 30 Oct 2013, 15:00
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 19:14; edited 1 time in total
Post 30 Oct 2013, 15:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20344
Location: In your JS exploiting you and your system
revolution 30 Oct 2013, 15:05
HaHaAnonymous wrote:
Humans will never meet perfection.
That depends upon how you define perfection.
Post 30 Oct 2013, 15:05
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.