Re: oleaut32: do not crash in logging if string is NULL
Aric Stewart <aric(a)codeweavers.com> writes:
@@ -68,10 +68,16 @@ typedef struct _marshal_state {
/* used in the olerelay code to avoid having the L"" stuff added by debugstr_w */ static char *relaystr(WCHAR *in) { - char *tmp = (char *)debugstr_w(in); - tmp += 2; - tmp[strlen(tmp)-1] = '\0'; - return tmp; + static char szNull[] = "<NULL>"; + if (in) + { + char *tmp = (char *)debugstr_w(in); + tmp += 2; + tmp[strlen(tmp)-1] = '\0'; + return tmp; + } + else + return szNull; }
This should never happen. Places that can get a null pointer should use the standard debugstr_w. -- Alexandre Julliard julliard(a)winehq.org
Meaning the place where I am finding this is different bug? In deserialize_param in the VT_BSTR case if the byte_length of the BSTR that we are deserializing is -1 then BSTR_UserUnmarshal places NULL into *arg. I will admit I know very little about this code but having it crash when trying to log seemed very wrong. Should I change the if (debugout) TRACE_(olerelay)("%s",relaystr(*(BSTR *)arg)); to a simple debugstr_w or is this revealing a deeper problem somewhere? thanks, -aric Alexandre Julliard wrote:
Aric Stewart <aric(a)codeweavers.com> writes:
@@ -68,10 +68,16 @@ typedef struct _marshal_state {
/* used in the olerelay code to avoid having the L"" stuff added by debugstr_w */ static char *relaystr(WCHAR *in) { - char *tmp = (char *)debugstr_w(in); - tmp += 2; - tmp[strlen(tmp)-1] = '\0'; - return tmp; + static char szNull[] = "<NULL>"; + if (in) + { + char *tmp = (char *)debugstr_w(in); + tmp += 2; + tmp[strlen(tmp)-1] = '\0'; + return tmp; + } + else + return szNull; }
This should never happen. Places that can get a null pointer should use the standard debugstr_w.
Aric Stewart wrote:
Meaning the place where I am finding this is different bug?
In deserialize_param in the VT_BSTR case if the byte_length of the BSTR that we are deserializing is -1 then BSTR_UserUnmarshal places NULL into *arg.
I will admit I know very little about this code but having it crash when trying to log seemed very wrong.
Should I change the if (debugout) TRACE_(olerelay)("%s",relaystr(*(BSTR *)arg)); to a simple debugstr_w or is this revealing a deeper problem somewhere?
thanks, -aric
By the way I am seeing this when looking at Print Preview in IE7. -aric
Aric Stewart <aric(a)codeweavers.com> writes:
Meaning the place where I am finding this is different bug?
In deserialize_param in the VT_BSTR case if the byte_length of the BSTR that we are deserializing is -1 then BSTR_UserUnmarshal places NULL into *arg.
I will admit I know very little about this code but having it crash when trying to log seemed very wrong.
Should I change the if (debugout) TRACE_(olerelay)("%s",relaystr(*(BSTR *)arg)); to a simple debugstr_w or is this revealing a deeper problem somewhere?
It's an arbitrary string so yes, it should be using debugstr_w. -- Alexandre Julliard julliard(a)winehq.org
participants (2)
-
Alexandre Julliard -
Aric Stewart