This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] setup.exe SEGV on WinXP/Pro


Corinna Vinschen writes:
>> -  return std::string(hexdigest);
>      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> I'm wondering if that was the problem.

I was wondering about this, too â but then the SEGV should have happened
in the calling function.  I believe that the vetting of hexdigest[32]
with a zero was the actual point of failure.  That really should not
happen, I think, but then I haven't chased it down to the actual
instructions.

>  This expression constructs a
> std:string and then immediately destructs it since the scope is limited
> to the end of the function (which the return statement is all about).

This being C++, the compiler is expected to copy the temporary object to
the return object or (as would be possible here) to construct the
temporary object in the place of the return object, thereby saving the
copy operation.

> Reading the value of this object in the parent function is basically
> luck, isn't it?

If it was just giving out a char* that would be a common mistake to
make, but not much of C++ would work if that was the case when an actual
object is involved.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]