flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [BUG]bug in "IF.inc"?

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 09 Feb 2010, 12:47
Hello guys,

Please, look at this code:

Code:


include 'win32ax.inc' 
include 'macro\if.inc'

.data

p1 db 0

.code

  start:

       lea     eax, [p1]         ; [eax] = 0

   .if ~(byte [eax])

               db 0cch

 .endif


      .if ~byte [eax]

         db 0cch

 .endif


      invoke  MessageBox,HWND_DESKTOP,"Hi! I'm the example program!",invoke GetCommandLine,MB_OK
       invoke  ExitProcess,0

.end start
    


The second ".if" is processed correctly so, the "db 0cch" is *executed*.

But the first ".if" does *not* execute the "db 0cch"!!!

So, it seems that the parenthesis are messing all out?

Thanks!
Post 09 Feb 2010, 12:47
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20335
Location: In your JS exploiting you and your system
revolution 09 Feb 2010, 12:52
Compiles to:
Code:
00402006    8038 00         cmp     byte[eax],0
00402009    74 01           jz      0x0040200c
0040200b    cc              int3
0040200c    8038 00         cmp     byte[eax],0
0040200f    75 01           jnz     0x00402012
00402011    cc              int3    
Bug confirmed.
Post 09 Feb 2010, 12:52
View user's profile Send private message Visit poster's website Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 09 Feb 2010, 21:38
Thanks revolution for confirming the bug.

Is the bug related to the "IF.INC" file or a fasm bug?

Thanks!
Post 09 Feb 2010, 21:38
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20335
Location: In your JS exploiting you and your system
revolution 10 Feb 2010, 01:35
This is related to the 'if.inc' macro file. Not to the fasm core assembler. But still definitely needs fixing.
Post 10 Feb 2010, 01:35
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 10 Feb 2010, 08:58
alorent,

You're right, this bug is related to parentheses handling in PARSECOND macro. Negation was added twice, before and after opening parenthesis. This should fix it:
Code:
      match (,symb                      ; 134
      \\\{                              ; 135
          parsed equ parsed neg@cond,<  ; 136
          define neg@cond               ; ADDED
          define nest@cond +            ; 137
          define symb@cond              ; 138
      \\\}                              ; 139    
Post 10 Feb 2010, 08:58
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20335
Location: In your JS exploiting you and your system
revolution 10 Feb 2010, 09:03
With baldr's fix: now compiles to:
Code:
00402006    8038 00         cmp     byte[eax],0
00402009    75 01           jnz     0x0040200c
0040200b    cc              int3
0040200c    8038 00         cmp     byte[eax],0
0040200f    75 01           jnz     0x00402012
00402011    cc              int3    
Fix confirmed.
Post 10 Feb 2010, 09:03
View user's profile Send private message Visit poster's website Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 10 Feb 2010, 11:13
Thanks baldr!!!

Great work!!! Very Happy
Post 10 Feb 2010, 11:13
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 10 Feb 2010, 16:19
I included the fix in the latest 1.69.12 package.
Post 10 Feb 2010, 16:19
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1900
DOS386 14 Feb 2010, 14:22
Tomasz Grysztar wrote:
I included the fix in the latest 1.69.12 package.


COOL Smile 1.69.12 is out and announcement is hidden in the Macroinstructions subforum. Could you please look into this bug for 1.69.13 ?
Post 14 Feb 2010, 14:22
View user's profile Send private message 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.