flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [minor] Redundant "out of memory" check. v1.71.06

Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20627
Location: In your JS exploiting you and your system
revolution 26 Nov 2012, 15:39
I notice a low priority problem in ASSEMBLE.ASM

Line ~970:
Code:
      close_virtual_addressing_space:
<snip 13 lines>
        cmp     eax,[ebx+8]
        jbe     out_of_memory
<snip>    
This code appears to be comparing a memory address with the address space flags. Fortunately the current highest possible value for the flags dword is ~0x3xxxx and the lowest possible memory address in Windows is ~0x100000 so the test always passes.

But I also notice that even if the correct offset of [ebx+0x18] is given that the test can never fail anyway. If the virtual block can successfully be filled then it is guaranteed to be able to be moved upwards to the top of memory with the minimum amount of space available of 0xff bytes. If the virtual block is filled more, then a memory error is detected by other code before this code is ever reached.

I would suggest to delete both of those lines. Just to avoid possible future problems if the last byte of the flags dword is ever utilized (or if the third byte gains more status bits). Changing it to [ebx+0x18], while perhaps more correct, is also redundant.
Post 26 Nov 2012, 15:39
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.