Commit dc84b8a4 authored by Mike Hearn's avatar Mike Hearn Committed by Alexandre Julliard

Don't fault on NULL pointers in Is*Ptr functions.

parent 9b796515
...@@ -526,6 +526,8 @@ BOOL WINAPI IsBadReadPtr( ...@@ -526,6 +526,8 @@ BOOL WINAPI IsBadReadPtr(
UINT size ) /* [in] Size of block */ UINT size ) /* [in] Size of block */
{ {
if (!size) return FALSE; /* handle 0 size case w/o reference */ if (!size) return FALSE; /* handle 0 size case w/o reference */
if (!ptr) return TRUE;
if (!page_size) page_size = getpagesize(); if (!page_size) page_size = getpagesize();
__TRY __TRY
{ {
...@@ -564,6 +566,8 @@ BOOL WINAPI IsBadWritePtr( ...@@ -564,6 +566,8 @@ BOOL WINAPI IsBadWritePtr(
UINT size ) /* [in] Size of block in bytes */ UINT size ) /* [in] Size of block in bytes */
{ {
if (!size) return FALSE; /* handle 0 size case w/o reference */ if (!size) return FALSE; /* handle 0 size case w/o reference */
if (!ptr) return TRUE;
if (!page_size) page_size = getpagesize(); if (!page_size) page_size = getpagesize();
__TRY __TRY
{ {
...@@ -641,6 +645,8 @@ BOOL WINAPI IsBadStringPtrA( ...@@ -641,6 +645,8 @@ BOOL WINAPI IsBadStringPtrA(
LPCSTR str, /* [in] Address of string */ LPCSTR str, /* [in] Address of string */
UINT max ) /* [in] Maximum size of string */ UINT max ) /* [in] Maximum size of string */
{ {
if (!str) return TRUE;
__TRY __TRY
{ {
volatile const char *p = str; volatile const char *p = str;
...@@ -662,6 +668,8 @@ BOOL WINAPI IsBadStringPtrA( ...@@ -662,6 +668,8 @@ BOOL WINAPI IsBadStringPtrA(
*/ */
BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT max ) BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT max )
{ {
if (!str) return TRUE;
__TRY __TRY
{ {
volatile const WCHAR *p = str; volatile const WCHAR *p = str;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment