Module: wine Branch: master Commit: 2eed0cdb8f860d37f4efa631719a0a9ae4f721e1 URL: https://source.winehq.org/git/wine.git/?a=commit;h=2eed0cdb8f860d37f4efa6317...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Sep 18 15:13:19 2020 +0200
include: Don't use IsBadStringPtr in debug functions for Unix libraries.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/unix/virtual.c | 44 -------------------------------------------- include/wine/debug.h | 4 ++++ 2 files changed, 4 insertions(+), 44 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 22d328b1ce..62b2ca1346 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3201,50 +3201,6 @@ BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size ) }
-/************************************************************* - * IsBadStringPtrA - * - * IsBadStringPtrA replacement for ntdll, to catch exception in debug traces. - */ -BOOL WINAPI IsBadStringPtrA( LPCSTR str, UINT_PTR max ) -{ - if (!str) return TRUE; - __TRY - { - volatile const char *p = str; - while (p != str + max) if (!*p++) break; - } - __EXCEPT_SYSCALL - { - return TRUE; - } - __ENDTRY - return FALSE; -} - - -/************************************************************* - * IsBadStringPtrW - * - * IsBadStringPtrW replacement for ntdll, to catch exception in debug traces. - */ -BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT_PTR max ) -{ - if (!str) return TRUE; - __TRY - { - volatile const WCHAR *p = str; - while (p != str + max) if (!*p++) break; - } - __EXCEPT_SYSCALL - { - return TRUE; - } - __ENDTRY - return FALSE; -} - - /*********************************************************************** * virtual_uninterrupted_read_memory * diff --git a/include/wine/debug.h b/include/wine/debug.h index 912d61a90a..e064aaefb8 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -225,7 +225,9 @@ static inline const char *wine_dbgstr_an( const char *str, int n )
if (!str) return "(null)"; if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) ); +#ifndef WINE_UNIX_LIB if (IsBadStringPtrA( str, n )) return "(invalid)"; +#endif if (n == -1) for (n = 0; str[n]; n++) ; *dst++ = '"'; while (n-- > 0 && dst <= buffer + sizeof(buffer) - 9) @@ -267,7 +269,9 @@ static inline const char *wine_dbgstr_wn( const WCHAR *str, int n )
if (!str) return "(null)"; if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) ); +#ifndef WINE_UNIX_LIB if (IsBadStringPtrW( str, n )) return "(invalid)"; +#endif if (n == -1) for (n = 0; str[n]; n++) ; *dst++ = 'L'; *dst++ = '"';