flat assembler
Message board for the users of flat assembler.

Index > IDE Development > [solved] error_outside_compiler: (bug?)

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 23 Aug 2011, 20:32
Code:
;FASM.INC
;--------
error_outside_compiler:
     mov     esp,[resume_esp]
    jmp     [resume_eip]
    

[resume_esp] and [resume_eip] are not initialized.
The only place where these variables are initialized is in "CalculatorDialog"
... nothing to do with the compiler!

If the code requires "error_outside_compiler",
Code:
assembler_error:
        cmp     [hthread],0
 je      error_outside_compiler    
... then it is the crash guaranteed!

my solution:
Code:
;FASM.INC
error_outside_compiler: jmp error_outside

;ERRORS.INC
error_outside:
   push    _error_outside
      jmp     fatal_error

;MESSAGES.INC
_error_outside db ' error outside compiler',0
    


_________________
I am not young enough to know everything (Oscar Wilde)- Image


Last edited by ouadji on 23 Aug 2011, 22:38; edited 1 time in total
Post 23 Aug 2011, 20:32
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20410
Location: In your JS exploiting you and your system
revolution 23 Aug 2011, 21:07
ouadji wrote:
If the code requires "error_outside_compiler" ...
...then initialise [resume_esp] and [resume_eip] before use.
Post 23 Aug 2011, 21:07
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 23 Aug 2011, 21:16
Quote:
..then initialise [resume_esp] and [resume_eip] before use.
?... yes precisely, but this is not done,
these two variables are not initialized,
nor in the compiler, nor in the editor.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 23 Aug 2011, 21:16
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20410
Location: In your JS exploiting you and your system
revolution 23 Aug 2011, 21:30
ouadji wrote:
Quote:
..then initialise [resume_esp] and [resume_eip] before use.
?... yes precisely, but this is not done,
these two variables are not initialized,
nor in the compiler, nor in the editor.
It is done. By the code that is "outside the compiler", namely the calculator. Have you tracked down which code uses error_outside_compiler?
Post 23 Aug 2011, 21:30
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 23 Aug 2011, 22:22
Quote:
Have you tracked down which code uses error_outside_compiler?
the compiler
Code:
;errors.inc
;----------
error_with_source:
   cmp     [symbols_file],0
    je      assembler_error
     call    dump_preprocessed_source
    call    restore_preprocessed_source
 jmp     assembler_error

fasm.inc
;;------
assembler_error:
 cmp     [hthread],0
 je      error_outside_compiler

    
Quote:
It is done. By the code that is "outside the compiler", namely the calculator

no, it is not done, the initialization of these two variables into the code of the calculator has nothing to do with the compiler. if I use the compiler (Run/Compile), these two variables are not initialised, [resume_esp]=0 and [resume_eip]=0.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 23 Aug 2011, 22:22
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 23 Aug 2011, 22:36

I understood !
The calculator uses a piece of code of the compiler.
Code:
proc   CalculatorDialog hwnd,msg,wparam,lparam
     ...
 xor     eax,eax
     mov     [hthread],eax ;<--- ! [hthread]==0
       ...
 call    convert_expression
  ...
 call    calculate_expression
    
Code:
assembler_error:
     cmp     [hthread],0 ;<---------  ==0 from the calculator
 je      error_outside_compiler  ;!=0 from the compiler
      call    show_display_buffer
    

this condition is never true if the code comes from the compiler!
but always true if the code comes from the calculator
(It's clever, well done Tomasz!)


I still missed an opportunity to keep quiet! Wink


_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 23 Aug 2011, 22:36
View user's profile Send private message Send e-mail 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.