Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-19-2014, 15:45
DMichael's Avatar
DMichael DMichael is offline
Family
 
Join Date: Apr 2012
Location: Israel
Posts: 197
Rept. Given: 138
Rept. Rcvd 281 Times in 72 Posts
Thanks Given: 13
Thanks Rcvd at 31 Times in 25 Posts
DMichael Reputation: 200-299 DMichael Reputation: 200-299 DMichael Reputation: 200-299
how can i check bad pointer on asm?

ok i guys im have soft that im need to patch it crash..so it just get bad pointer and crashes i tryed to check for bad pointer in similiar way:

CMP DWORD PTR DS:[EAX],0
JE @SkipFunction

but it already fails to read for comparexD so what should i do ?
Reply With Quote
  #2  
Old 03-19-2014, 17:28
Carbon Carbon is offline
VIP
 
Join Date: Sep 2013
Posts: 113
Rept. Given: 7
Rept. Rcvd 189 Times in 48 Posts
Thanks Given: 0
Thanks Rcvd at 59 Times in 18 Posts
Carbon Reputation: 100-199 Carbon Reputation: 100-199
Use VirtualQuery http://msdn.microsoft.com/en-us/library/windows/desktop/aa366902(v=vs.85).aspx
Reply With Quote
  #3  
Old 03-22-2014, 00:10
qkumba qkumba is offline
Friend
 
Join Date: Nov 2011
Posts: 14
Rept. Given: 0
Rept. Rcvd 4 Times in 4 Posts
Thanks Given: 0
Thanks Rcvd at 3 Times in 3 Posts
qkumba Reputation: 4
The "proper" API is IsBadReadPtr(), but keep in mind that any registered Vectored Exception Handler will gain control if the pointer is bad.
Reply With Quote
  #4  
Old 03-22-2014, 01:13
mcp mcp is offline
Friend
 
Join Date: Dec 2011
Posts: 73
Rept. Given: 4
Rept. Rcvd 12 Times in 11 Posts
Thanks Given: 7
Thanks Rcvd at 47 Times in 35 Posts
mcp Reputation: 12
@qkumba
Actually, that API is fundamentally broken because it is not free of side effects, e.g., consider the case where you use that API on a guard page. After using that API, that page won't be a guard page anymore!

Due to race conditions, there is no general safe way to test if a pointer is valid, other than making sure it is only obtained for safe addresses. Pretty much any address can become invalid after you tested the pointer, and vice versa.

The right question would be to ask: what are you actually trying to do?
Reply With Quote
  #5  
Old 03-22-2014, 01:27
deepzero's Avatar
deepzero deepzero is offline
VIP
 
Join Date: Mar 2010
Location: Germany
Posts: 300
Rept. Given: 111
Rept. Rcvd 64 Times in 42 Posts
Thanks Given: 178
Thanks Rcvd at 216 Times in 92 Posts
deepzero Reputation: 64
The API is also deprecated, and you shouldnt use for a variety of reasons. The truth is that there is no way of checking for a pointer that once was valid and now might be invalid.


Whatever returns the pointer should make sure there is no way of passing an invalid pointer, and should return 0 if there is a problem of some sort.
Reply With Quote
  #6  
Old 03-22-2014, 03:03
DMichael's Avatar
DMichael DMichael is offline
Family
 
Join Date: Apr 2012
Location: Israel
Posts: 197
Rept. Given: 138
Rept. Rcvd 281 Times in 72 Posts
Thanks Given: 13
Thanks Rcvd at 31 Times in 25 Posts
DMichael Reputation: 200-299 DMichael Reputation: 200-299 DMichael Reputation: 200-299
thanks for the reply but i already slove this
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resolving Stack Pointer problem java3ever General Discussion 1 06-20-2017 13:57
Help Me - CRC Check and FileSize Check byvs General Discussion 11 07-31-2003 13:32
CRC Check - Help Me!! byvs General Discussion 1 06-19-2002 13:13


All times are GMT +8. The time now is 06:36.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( 1998 - 2024 )