Results 1 to 3 of 3

Thread: IceInternal::incRef segmentation fault

  1. #1
    xdm's Avatar
    xdm
    xdm is offline ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    588

    IceInternal::incRef segmentation fault

    Hello i have the next slice and c++ codes thats produce a segmentation fault in IceInternal::incRef i atach the stack trace of this crash, any ideas what is wrong

    i using Ice-3.0.1 | gcc version 3.4.5 | AMD 64

    thanks

    Code:
    module Oz
    {
    	module Web
    	{
    		/**
    		 * Este componente emcapsula el objeto Cookie del protocolo HTTP
    		 */
    		interface CookieAdmin
    		{
    			string getPath();
    			void setName(string name);
    			string getName();
    
    			void setValue(string value);
    			string getValue();
    
    			bool isSecure();
    			int getTimeOut();
    		};
    
    		class Cookie 
    			implements CookieAdmin
    		{
    			string name;
    			string path;
    			string value;
    			int timeOut;
    			bool secure;
    		};
    		
    		dictionary<string,Cookie>CookieMap;
    	};
    };
    Code:
    void
    WebAppHandler::writeCookies(const ResponsePtr& response,MaRequest* rq)
    {
    	Oz::Web::CookieMap::iterator it;
    	for(it=response->getCookies().begin();
    		it!=response->getCookies().end();
    		++it)
    	{
    		CookiePtr cookie = (*it).second;
    		char* name=(char*)malloc((cookie->getName().length()+1)*sizeof(char));
    		strcpy(name,cookie->getName().c_str());
    		
    		char* value=(char*)malloc((cookie->getValue().length()+1)*sizeof(char));
    		strcpy(value,cookie->getValue().c_str());
    		
    		char* path=(char*)malloc((cookie->getPath().length()+1)*sizeof(char));
    		strcpy(path,cookie->getPath().c_str());
    		
    		rq->setCookie(name,value,cookie->getTimeOut(),path,cookie->isSecure());
    
    		delete name;
    		delete value;
    		delete path;
    
    		cookie = 0;
    	}
    }
    Code:
    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 46912538663520 (LWP 27906)]
    0x0000000000000000 in ?? ()
    (gdb) bt
    #0  0x0000000000000000 in ?? ()
    #1  0x00002aaaae7aa14b in IceInternal::incRef (p=0x2aaaabc5e320) at Cookie.cpp:55
    #2  0x00002aaaad88ba8d in Handle (this=0x7fffffbe25f0, r=@0x7fffffbe26b0) at Handle.h:83
    #3  0x00002aaaad888f82 in WebAppHandler::writeCookies (this=0x593fd0, response=@0x7fffffbe2b60, rq=0x58fed0) at WebAppHandler.cpp:344
    #4  0x00002aaaad887ffb in WebAppHandler::writeResponse (this=0x593fd0, response=@0x7fffffbe2b60, rq=0x58fed0) at WebAppHandler.cpp:290
    #5  0x00002aaaad887e8e in WebAppHandler::run (this=0x593fd0, rq=0x58fed0) at WebAppHandler.cpp:272
    #6  0x00002aaaaac0b8cb in MaRequest::runHandlers () from /opt/appweb/lib/libappWeb.so.1
    #7  0x00002aaaaac070fd in MaRequest::processRequest () from /opt/appweb/lib/libappWeb.so.1
    #8  0x00002aaaaac06ad0 in MaRequest::readEvent () from /opt/appweb/lib/libappWeb.so.1
    #9  0x00002aaaaac0676c in MaRequest::acceptEvent () from /opt/appweb/lib/libappWeb.so.1
    #10 0x00002aaaaac1580b in MprSocket::ioProc () from /opt/appweb/lib/libappWeb.so.1
    #11 0x00002aaaaac156dc in MprSocket::getPort () from /opt/appweb/lib/libappWeb.so.1
    #12 0x00002aaaaac0f9d6 in MprSelectService::serviceIO () from /opt/appweb/lib/libappWeb.so.1
    #13 0x00002aaaaabff71c in Mpr::serviceIO () from /opt/appweb/lib/libappWeb.so.1
    #14 0x00002aaaaabff454 in Mpr::serviceEvents () from /opt/appweb/lib/libappWeb.so.1
    #15 0x0000000000400ff5 in Oz::Web::WebServer::run (this=0x7fffffbe3310, argc=1, argv=0x7fffffbe3428) at WebServer.cpp:56
    #16 0x00000000004010b9 in main (argc=1, argv=0x7fffffbe3428) at main.cpp:9

  2. #2
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Jose,

    Code:
    Oz::Web::CookieMap::iterator it;
    	for(it=response->getCookies().begin();
    		it!=response->getCookies().end();
    		++it)
    	{
    		CookiePtr cookie = (*it).second;
    What is the signature of getCookies()? If it returns a copy, then your iteration is not correct and you crash because you iterate too far in the first cookies collection.

    Cheers,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  3. #3
    xdm's Avatar
    xdm
    xdm is offline ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    588
    getCookies returns a CookieMap , i now see whatś wrong

    thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ICE 3.4.0 / 3.4.1 bug (segmentation fault)
    By PrzemekD in forum Bug Reports
    Replies: 6
    Last Post: 08-05-2010, 12:05 PM
  2. Segmentation fault with Ice for Python
    By bobc in forum Help Center
    Replies: 1
    Last Post: 01-20-2009, 12:38 PM
  3. Segmentation fault with Freeze
    By Yunqiao Yin in forum Help Center
    Replies: 2
    Last Post: 02-12-2007, 08:08 PM
  4. Segmentation fault in Icestorm
    By davidcr1983 in forum Help Center
    Replies: 4
    Last Post: 08-08-2006, 09:37 AM
  5. Replies: 2
    Last Post: 01-08-2006, 08:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •