Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3999150
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:37:11+00:00 2026-05-20T07:37:11+00:00

I am porting from Centos to Cygwin and find that my application is exiting

  • 0

I am porting from Centos to Cygwin and find that my application is exiting with no error message and exit status zero mid execution during the constructor for Botan::InitializationVector.

If I try to attach with gdb proactively in main() where it is waiting on a spin variable, I don’t get a normal stack trace:

(gdb) where
#0  0x7c90120f in ntdll!DbgUiConnectToDbg ()
   from /cygdrive/c/WINDOWS/system32/ntdll.dll
#1  0x7c952119 in ntdll!KiIntSystemCall ()
   from /cygdrive/c/WINDOWS/system32/ntdll.dll
#2  0x00000005 in ?? ()
#3  0x00000000 in ?? ()

So with no gdb, it is hard to figure out what is going wrong.

Why would I get no error message on Cygwin yet the application would exit mid execution?

I deduce it is inside the constructor due to clog only showing for line before and not after constructor:

clog << "  About to create iv for Botan.\n";
Botan::InitializationVector iv(_rng, size);
clog << "  About to copy iv for Botan.\n";

Botan is open source: http://botan.randombit.net/ Here are some code snippets from src/sym_algo/symkey.{h,cpp}:

typedef OctetString InitializationVector;

class BOTAN_DLL OctetString
{
public:
  u32bit length() const { return bits.size(); }
  SecureVector<byte> bits_of() const { return bits; }

  const byte* begin() const { return bits.begin(); }
  const byte* end() const   { return bits.end(); }

  std::string as_string() const;

  OctetString& operator^=(const OctetString&);

  void set_odd_parity();

  void change(const std::string&);
  void change(const byte[], u32bit);
  void change(const MemoryRegion<byte>& in) { bits = in; }

  OctetString(class RandomNumberGenerator&, u32bit len);
  OctetString(const std::string& str = "") { change(str); }
  OctetString(const byte in[], u32bit len) { change(in, len); }
  OctetString(const MemoryRegion<byte>& in) { change(in); }
private:
  SecureVector<byte> bits;
};

OctetString::OctetString(RandomNumberGenerator& rng,
                     u32bit length)
{
   bits.create(length);
   rng.randomize(bits, length);
}

I moved the failing code into main() and it works fine. I also put a try catch … around the code and no exceptions are being thrown. Something goes wrong between main() and the point of failure later in the application. I can do a divide and conquer to narrow down the exact point where it no longer works. One of the Botan developers gave me this stripped down code to use instead that also fails:

Botan::AutoSeeded_RNG _rng;
unsigned int size = 1; // or 16, or 1452 all fail.
Botan::SecureVector<Botan::byte> iv_val(size);
cerr << "We get to here." << endl;
_rng.randomize(&iv_val[0], size);
cerr << "But not here." << endl;

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}
(gdb) p *rng
$9 = {_vptr$RandomNumberGenerator = 0x656e6f4e}

Here is auto_rng.h code:

class BOTAN_DLL AutoSeeded_RNG : public RandomNumberGenerator
  {
  public:
    void randomize(byte out[], u32bit len)
    { rng->randomize(out, len); }           // SEGV on this line.
    bool is_seeded() const
    { return rng->is_seeded(); }
    void clear() throw() { rng->clear(); }
    std::string name() const
    { return "AutoSeeded(" + rng->name() + ")"; }

    void reseed(u32bit poll_bits = 256) { rng->reseed(poll_bits); }
    void add_entropy_source(EntropySource* es)
    { rng->add_entropy_source(es); }
    void add_entropy(const byte in[], u32bit len)
    { rng->add_entropy(in, len); }

    AutoSeeded_RNG(u32bit poll_bits = 256);
    ~AutoSeeded_RNG() { delete rng; }
  private:
    RandomNumberGenerator* rng;
  };
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:37:12+00:00Added an answer on May 20, 2026 at 7:37 am

    Cygwin apps are multithreaded (e.g., one thread is the signal listener thread). Use info threads in gdb to find the thread that really faulted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a legacy Struts 1.2.8 application that I'm maintaining and porting from Oracle
I have some code that I am porting from an SGI system using the
I have an application I'm porting from MSSQL and .NET to SQLite and Mono.
Question appears during porting application from JSF 1.2 to JSF 2.0.3 (Mojarra). I have
I am porting an application from wpf to asp.net mvc. In the wpf I
I've got a C++ app that I'm porting from Win32 to OSX. I'd like
I've got an integer Coordinate Structure for a Hex grid, that I'm porting from
I have an app that I'm porting from PHP/symfony to Ruby/Rails. Though the language
I've a C++ project that I'm currently porting from VS2008 to VS2010. When I
I have some code, that I'm currently porting from OS X to Linux (console

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.