Possible 0-pointer crash in SystemInfo::getProcessName()
--------------------------------------------------------

                 Key: QPID-1998
                 URL: https://issues.apache.org/jira/browse/QPID-1998
             Project: Qpid
          Issue Type: Bug
          Components: C++ Client
    Affects Versions: 0.5
         Environment: Windows
            Reporter: Steve Huston
            Assignee: Steve Huston
             Fix For: 0.6


As reported on us...@qpid.apache.org by Alan Conway:

Nithesh Shetty wrote:
[snip]
>  
> Now the problem  is it give exception if u check the call stack then 
> it show ptr = 0x00000000 line 664
> qpid::sys::SystemInfo::getProcessName() 
> qpid::client::ConnectionHandler::ConnectionHandle()
> qpid::client::ConnectionImpl::ConnectionImp()
> qpid::client:Connection::open() ( open connection is from read thread)
>  
> tested the above code on windows
>  

There's a bug in the windows code for getProcessName which might be the cause 
of 
your woes.

std::string SystemInfo::getProcessName()
{
     // Only want info for the current process, so ask for something specific.
     // The module info won't be used here but it keeps the snapshot limited to
     // the current process so a search through all processes is not needed.
     HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, 0);
     if (snap == INVALID_HANDLE_VALUE)
         return 0;
         ^^^^^^^^

This return statment is constructing a string from a 0 pointer which is going 
to 
lead to a null pointer crash. I don't know if its likely to be the cause of 
your 
crash since I don't know under what circumstances you'd get the 
INVALID_HANDLE_VALUE.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscr...@qpid.apache.org

Reply via email to