flat assembler
Message board for the users of flat assembler.

Index > Linux > fasdump : program to dump contents of fas files

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
Tarkin



Joined: 27 Aug 2010
Posts: 22
Tarkin 04 Sep 2010, 06:43
...the file? I can't seem to find it... Embarassed

TIA,
Tarkin
Post 04 Sep 2010, 06:43
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20519
Location: In your JS exploiting you and your system
revolution 04 Sep 2010, 06:53
Make sure you are logged in and then see the first post in this thread.
Post 04 Sep 2010, 06:53
View user's profile Send private message Visit poster's website Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 04 Sep 2010, 07:31
Hello, while testing your program I got an error
'File is corrupt, signature is invalid'
in your source code you define hdr.signature 1B736166 but
fas use 1A736166, i changed in 1A736166 and now it's OK..
Code:
  if (hdr.signature != 0x1B736166)  {
            fprintf(stderr, "File is corrupt, signature is invalid\n");
              goto out_error;
     }    

Fasm signature is
Code:
                                flat assembler
                       Symbolic information file format


   Table 1  Header
  /-- -----------------------------------------------------------------------\
  | Offset | Size    | Description                                         |
  |========|=========|======================================================|
  |   +0   |  dword  | Signature 1A736166h (little-endian).               |
  |--------|---------|------------------------------------------------------|    
Wink

_________________
Nil Volentibus Arduum Razz
Post 04 Sep 2010, 07:31
View user's profile Send private message Reply with quote
Tarkin



Joined: 27 Aug 2010
Posts: 22
Tarkin 04 Sep 2010, 07:38
Doh! I have to remember to login...

Have a suggestion:

Code:
#define FASMSIGNATURE 0xDEADBEEF /* Change 0xDEADBEEF to the current fasm signature */
...
/*if (hdr.signature != 0x1B736166)  {*/
  if (hdr.signature != FASMSIGNATURE)  {
    


For fasm 1.69.18, the signature is 0x1A736166

Thanks for fasdump! I will try and work on a shell script which will filter fasdump's output and
prints out fixed-up addresses ( for Linux ELF 32 ).

TTFN,
Tarkin
Post 04 Sep 2010, 07:38
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 04 Sep 2010, 08:21
Tarkin wrote:
For fasm 1.69.18, the signature is 0x1A736166
Note: http://board.flatassembler.net/topic.php?p=92185#92185
It was this way for fasm 1.68 already.
Post 04 Sep 2010, 08:21
View user's profile Send private message Visit poster's website Reply with quote
Tarkin



Joined: 27 Aug 2010
Posts: 22
Tarkin 04 Sep 2010, 08:40
Ah, yes, missed that post. But I was intending it as fix for fasdump, as DJ Mauretto pointed out.

Also, here is the awk one-liner I hinted at earlier:
Code:
fasdump -s prog.fas | awk '/(\.text)|(\.rodata)|(\.bss)/ { OFFSET=0x08048074; ADDR = strtonum($4) + OFFSET ; printf("%s : 0x%08X\n",$1,ADDR)  } '
    


Thanks all and HTH,
Tarkin
Post 04 Sep 2010, 08:40
View user's profile Send private message Reply with quote
mariosk8s



Joined: 29 Oct 2015
Posts: 1
Location: Hüfingen, Germany
mariosk8s 29 Oct 2015, 09:54
I experienced segfaults on linux due to 2s compliment issues when casting (uint32_t)(*token_ptr).
Something like 89 00 00 00 turned into 89 ff ff ff resulting in rather long lengths.
The attached patch makes these char types unsigned (uint8_t).
I also adjusted the hdr.signature to 1B.

I added the .txt extension because of "The Extension patch is not allowed" error when posting.


Description: patch to make char uint8_t
Download
Filename: fasdump.patch.txt
Filesize: 3.78 KB
Downloaded: 2085 Time(s)


_________________
Regards

Mario
Post 29 Oct 2015, 09:54
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:  
Goto page Previous  1, 2

< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.