Re: ATL vs [out,optional] VARIANT *
From: Nikola Dudar [MSFT] (nikolad_at_online.microsoft.com)
Date: 01/10/05
- Next message: Aswin: "Atl composite control Display of Control Problem"
- Previous message: Nikola Dudar [MSFT]: "Re: ATL (latest) and web services"
- In reply to: ATS: "BUG: ATL vs [out,optional] VARIANT *"
- Next in thread: ATS: "Re: ATL vs [out,optional] VARIANT *"
- Reply: ATS: "Re: ATL vs [out,optional] VARIANT *"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 9 Jan 2005 21:14:05 -0800
Thank you for reporting this. Is this VS2003 or VS2005 Beta 1? Please add
information about what version of VS is this and report this bug on
http://lab.msdn.microsoft.com/productfeedback/ if you can repro it with
VS2005 Beta1.
Thanks,
Nikola
--
Nikola Dudar
Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers no rights.
"ATS" <ATS@discussions.microsoft.com> wrote in message
news:7F0B5347-28BC-45F2-B0FA-B4DA80A974B0@microsoft.com...
> BUG: ATL vs [out,optional] VARIANT *
>
> I've found a bug with ATL and declaring a parameter on a method with
> [out,optional] VARIANT *. The DEBUG trace on the ATL proxy stub shows that
> is
> performs a VariantClear on the pvarVal pointed to VARIANT and then it
> deliberately sets that VARIANT's vt = VT_VARIANT without setting its own
> pvarVal. This will lead to a memory access error if one then uses the
> pvarVal
> because its vt = VT_VARIANT and the pvarVal is not NULL.
>
> Here is the trace:
>
> VARIANT* i2 = 0;
> 1004DC11 mov dword ptr [i2],0
> if (rgpVars[0]->vt == (VT_VARIANT | VT_BYREF)) {
> 1004DC1B mov eax,dword ptr [rgpVars]
> 1004DC1E movzx ecx,word ptr [eax]
> 1004DC21 cmp ecx,400Ch
> 1004DC27 jne $L228322+0B3h (1004DC58h)
> v = V_VARIANTREF(rgpVars[0]);
> 1004DC29 mov eax,dword ptr [rgpVars]
> 1004DC2C mov ecx,dword ptr [eax+8]
> 1004DC2F mov dword ptr [v],ecx
> ::VariantClear(v);
> 1004DC32 mov esi,esp
> 1004DC34 mov eax,dword ptr [v]
> 1004DC37 push eax
> 1004DC38 call dword ptr [__imp__VariantClear@4 (101367C4h)]
> 1004DC3E cmp esi,esp
> 1004DC40 call _RTC_CheckEsp (1006A660h)
> i2 = (VARIANT*) (v);
> 1004DC45 mov eax,dword ptr [v]
> 1004DC48 mov dword ptr [i2],eax
> v->vt = VT_VARIANT; <=== Error! BUG! ATL should set
> pvarVal to NULL after doing this, as otherwise the method may blow up on
> the
> VARIANT if it performs any Variant deallocation operations on it.
> 1004DC4E mov eax,dword ptr [v]
> 1004DC51 mov word ptr [eax],0Ch
> }
> else {
> 1004DC56 jmp $L228322+0BFh (1004DC64h)
> i2 = (VARIANT*) V_VARIANTREF(rgpVars[0]);
> 1004DC58 mov eax,dword ptr [rgpVars]
> 1004DC5B mov ecx,dword ptr [eax+8]
> 1004DC5E mov dword ptr [i2],ecx
> }
>
- Next message: Aswin: "Atl composite control Display of Control Problem"
- Previous message: Nikola Dudar [MSFT]: "Re: ATL (latest) and web services"
- In reply to: ATS: "BUG: ATL vs [out,optional] VARIANT *"
- Next in thread: ATS: "Re: ATL vs [out,optional] VARIANT *"
- Reply: ATS: "Re: ATL vs [out,optional] VARIANT *"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|