flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > one more bug :D

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
edfed 20 Feb 2008, 15:32
i meet this bug with fasmw 1.62.26
when i type some quoted strings with accents, frensh keyboard specific, fasm tell me it is not end qouted...
Post 20 Feb 2008, 15:32
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20402
Location: In your JS exploiting you and your system
revolution 20 Feb 2008, 15:35
Does it work with the double quote (")?
Post 20 Feb 2008, 15:35
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
edfed 20 Feb 2008, 15:40
no
Post 20 Feb 2008, 15:40
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20402
Location: In your JS exploiting you and your system
revolution 20 Feb 2008, 16:33
There are only 4 ways to get the missing end quote message
Code:
      convert_string:
   mov     al,22h
      stos    byte [edi]
  scas    dword [edi]
 mov     ebx,edi
      copy_string:
   lods    byte [esi]
  stos    byte [edi]
  cmp     al,0Ah
      je      missing_end_quote
   cmp     al,0Dh
      je      missing_end_quote
   or      al,al
       jz      missing_end_quote
   cmp     al,1Ah
      je      missing_end_quote    
So you must have one the above 4 characters, cr, lf, nul, or sub inside the quotes.
Post 20 Feb 2008, 16:33
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20402
Location: In your JS exploiting you and your system
revolution 20 Feb 2008, 16:40
Notice how Tomasz uses "scas dword [edi]" instead of "add edi,4".
Post 20 Feb 2008, 16:40
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 20 Feb 2008, 16:41
tomasz tries hard to keep FASM under 64KB Razz
Post 20 Feb 2008, 16:41
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
edfed 20 Feb 2008, 23:01
the problem is not fasm, but the string '^ 'is problematic, it is
27 5E 00 27

so, fasm see it as a end of string...
to avoid this bug, the test shall include a two char test.

or al,al
je missing_end_quote?
...
missing_end_quote?:
mov al,[esi-2]
cmp al,5eh
jne missing_end_quote
...
Post 20 Feb 2008, 23:01
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 20 Feb 2008, 23:11
> Notice how Tomasz uses "scas dword [edi]" instead of "add edi,4".

3 bytes -> 1 byte Shocked

> tomasz tries hard to keep FASM under 64KB

YES, but Sad
Post 20 Feb 2008, 23:11
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
edfed 20 Feb 2008, 23:30
this is size optimisation for sure, but Sad it will change the state of eax, so, to use with caution...

tomasz is not a beginner, he don't have to write the algo with basic inst, remember, he is the autor of the program you use for code... so .. thanks.
Post 20 Feb 2008, 23:30
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20402
Location: In your JS exploiting you and your system
revolution 20 Feb 2008, 23:39
edfed wrote:
it will change the state of eax, ...
No it doesn't.
Post 20 Feb 2008, 23:39
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20402
Location: In your JS exploiting you and your system
revolution 20 Feb 2008, 23:43
edfed wrote:
the problem is not fasm, but the string '^ 'is problematic, it is
27 5E 00 27

so, fasm see it as a end of string...
to avoid this bug, the test shall include a two char test.

or al,al
je missing_end_quote?
...
missing_end_quote?:
mov al,[esi-2]
cmp al,5eh
jne missing_end_quote
...
There is another way to solve the problem. Delete the two lines that check for nul.
Post 20 Feb 2008, 23:43
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
edfed 20 Feb 2008, 23:53
but it can make problems in case of effective end of file before the quote closer.
Post 20 Feb 2008, 23:53
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20402
Location: In your JS exploiting you and your system
revolution 21 Feb 2008, 00:01
Just try and see what happens. How does fasm recognise the end of file?

Code:
   mov     byte [edx],1Ah    
Hmm ...
Post 21 Feb 2008, 00:01
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
edfed 21 Feb 2008, 00:19
the best is to never try to quote strings with '^ ' obtained when typing a ^ accent, the key just after the p on azerty kb, and type a key that don't accept the accent, like p, k, b, t, f, w, , etc...
Post 21 Feb 2008, 00:19
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 21 Feb 2008, 06:20
try to use another editor/ide, which does not insert esc sequences
Post 21 Feb 2008, 06:20
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.