[botan-devel] Cygwin failure creating initialization vector

William K. Foster wkf at alum.mit.edu
Mon Feb 21 12:51:33 EST 2011


Hi Jack,

I got the debugger working (issue was I was looking at wrong thread by
default).

Now that I have the debugger working I see segv:

(gdb) s
Botan::AutoSeeded_RNG::randomize (this=0x1270380, out=0x5841420 "", len=1)
    at ../../src/Botan-1.8.11/build/include/botan/auto_rng.h:23
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x005d79ee in Botan::AutoSeeded_RNG::randomize (this=0x1270380,
    out=0x5841420 "", len=1)
    at ../../src/Botan-1.8.11/build/include/botan/auto_rng.h:23
(gdb) p rng
$7 = (class Botan::RandomNumberGenerator *) 0x5841324
(gdb) p *this
$8 = {<Botan::RandomNumberGenerator> = {
    _vptr$RandomNumberGenerator = 0x11efc14}, rng = 0x5841324}

Thanks.

-William

On Mon, Feb 21, 2011 at 9:23 AM, William K. Foster <wkf at alum.mit.edu> wrote:

> Hello Jack,
>
> I lowered the size down to 16 and it still fails.
>
> I added a try catch block around the code, and no exception is caught.
>
> I changed the code to what you show below, and the failure occurs inside
> the last line:
>
>
>     _rng.randomize(&iv_val[0], size);
>
> I also tried size 1 and it also fails the same way.
>
> Finally, I moved the code to the beginning of main() and it works fine.  So
> something is going wrong elsewhere that causes this to fail later.  How can
> we track this down best?
>
> Thanks.
>
> -William
>
>
>
> On Mon, Feb 21, 2011 at 7:32 AM, Jack Lloyd <lloyd at randombit.net> wrote:
>
>>
>>
>> Does it fail for a smaller value of size?
>>
>> Does the program terminate, or hang/infinite loop, or ... ?
>>
>> Does this code execute inside of a try/catch block? Some C++ runtimes,
>> including older versions of GCC's, will just silent abort in the case
>> of an uncaught exception. That would potentionally also explain the
>> bogus stack trace.
>>
>> This constructor is actually only two lines of code, so could
>> you also try this program:
>>
>>     Botan::AutoSeeded_RNG _rng;
>>     unsigned int size = 1452;
>>      Botan::SecureVector<Botan::byte> iv_val(size);
>>     _rng.randomize(&iv_val[0], size);
>>
>> With printfs or some such in between, so see where exactly it fails;
>> this may help narrow down the problem a bit.
>>
>> -Jack
>>
>> On Sun, Feb 20, 2011 at 06:51:22PM -0800, William K. Foster wrote:
>> > Hello,
>> >
>> > I have Cygwin building now, but when executing it fails on the last
>> > constructor:
>> >
>> >     Botan::AutoSeeded_RNG _rng;
>> >     unsigned int size = 1452;
>> >     Botan::InitializationVector iv(_rng, size);
>> >
>> > For some reason, I don't get any error message, and trying to attach
>> with
>> > GDB gives a bogus stack trace.  The program just stops execution at this
>> > point with no message.
>> >
>> > The Cygwin environment is not working as well as my Centos one, but the
>> code
>> > works fine up until this point of the InitializationVector constructor.
>> >
>> > How might I go about debugging why this fails here?
>> >
>> > Thanks.
>> >
>> > -William
>>
>> > _______________________________________________
>> > botan-devel mailing list
>> > botan-devel at randombit.net
>> > http://lists.randombit.net/mailman/listinfo/botan-devel
>>
>> _______________________________________________
>> botan-devel mailing list
>> botan-devel at randombit.net
>> http://lists.randombit.net/mailman/listinfo/botan-devel
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20110221/9822bf3d/attachment.html>


More information about the botan-devel mailing list