discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with GSFromUnicode in Unicode.m


From: Sebastian Reitenbach
Subject: Re: Problem with GSFromUnicode in Unicode.m
Date: Thu, 3 Mar 2011 10:27:17 +0100
User-agent: KMail/1.13.5 (Linux/2.6.34.7-0.7-xen; KDE/4.4.4; x86_64; ; )

Hi Richard,
On Thursday, March 03, 2011 09:21:22 am you wrote:
> On 2 Mar 2011, at 14:33, Sebastian Reitenbach wrote:
> > Hi,
> > 
> > When i want to install sieve scripts from ogo into the cyrus imapd sieve
> > daemon, ogo uses the tool sky_install_sieve. This tool crashes,
> > converting a unicode string (actually the filter list), due to a double
> > free?
> > 
> > As far as I can see, the problem might be in GSFromUnicode in Unicode.m,
> > see the backtrace below.
> > Attached patch fixes the problem for me, but I am not sure whether this
> > is actually right. I also don't have a mac to see whether/how it is
> > working there. The only thing I can tell is that with libFoundation, it
> > was working, and I guess it was also tested and working on the mac,
> > years ago.
> > 
> > This happens for me with gnustep-base-1.20.2. also the patch is against
> > it. I additionally check for zone != 0, since I don't think it makes
> > sense to free a zone which is already 0, which is was here for me all
> > the time. The patch also still applies to -trunk, with offset of -3
> > lines.
> 
> Thanks ... I looked at that code and I think the problem was a logic error
> (test of the dst pointer the wrong way round). I made small changes in svn
> trunk ... please give it a try.


I took the Unicode.m file from svn trunk, and compiled it with the gnustep-
base-0.20.2, since I don't have a system setup where gnustep is from svn and 
ogo is installed.
Now it segfaults in the line before, see below:

Program received signal SIGSEGV, Segmentation fault.
[Switching to process 17130, thread 0x85317400]
GSFromUnicode (dst=0x0, size=0xcfbc7fb0, src=0x87205000, slen=17740, 
enc=NSUTF8StringEncoding, zone=0x0, options=4) at Unicode.m:2490
2490      else if (ptr != buf && (dst != 0 || ptr != *dst))
Current language:  auto; currently minimal
(gdb) break
Breakpoint 1 at 0xa832573: file Unicode.m, line 2490.
(gdb) bt
#0  GSFromUnicode (dst=0x0, size=0xcfbc7fb0, src=0x87205000, slen=17740, 
enc=NSUTF8StringEncoding, zone=0x0, options=4) at Unicode.m:2490
#1  0x0a6594f8 in -[GSMutableString lengthOfBytesUsingEncoding:] 
(self=0x897ec668, _cmd=0x21f021c0, encoding=NSUTF8StringEncoding) at 
GSString.m:1390
#2  0x01f5338c in -[NGSieveClient putScript:script:] (self=0x7d35da88, 
_cmd=0x3c0024e8, _name=0x3c002684, _script=0x897ec668) at NGSieveClient.m:426
#3  0x1c0036bf in -[InstallSieve runWithArguments:] (self=0x81b87f48, 
_cmd=0x3c002528, _args=0x81727608) at sky_install_sieve.m:560
#4  0x1c0013e8 in +[InstallSieve runWithArguments:] (self=0x3c002260, 
_cmd=0x3c002530, _args=0x81727608) at sky_install_sieve.m:588
#5  0x1c002393 in gnustep_base_user_main (argc=13, argv=0xcfbc817c, 
env=0xcfbc81b4) at sky_install_sieve.m:606
#6  0x0a75b39e in main (argc=13, argv=Cannot access memory at address 0x4550
) at NSProcessInfo.m:933
#7  0x1c001147 in ___start ()
#8  0x1c0010c7 in _start ()
#9  0x00000000 in ?? ()
(gdb) frame 0
#0  GSFromUnicode (dst=0x0, size=0xcfbc7fb0, src=0x87205000, slen=17740, 
enc=NSUTF8StringEncoding, zone=0x0, options=4) at Unicode.m:2490
2490      else if (ptr != buf && (dst != 0 || ptr != *dst))
(gdb) list
2485            {
2486              *dst = ptr;
2487            }
2488        }
2489    #if     !GS_WITH_GC
2490      else if (ptr != buf && (dst != 0 || ptr != *dst))
2491        {
2492          NSZoneFree(zone, ptr);
2493        }
2494    #endif
(gdb) print ptr
$1 = (unsigned char *) 0xcfbc3764 ""
(gdb) print buf
$2 = ".blah\";\n }\nelsif anyof (header :contains [\"from\"] 
\"info@yalla.fo\", header :contains [\"from\"] \"email@humppa.blah.com\", 
header :contains [\"from\"] \"@newsletter.blah.com\")\n {\nfileinto 
\"INBOX.Shoppi"...
(gdb) print dst 
$3 = (unsigned char **) 0x0
(gdb) print ptr
$4 = (unsigned char *) 0xcfbc3764 ""
(gdb) print dst
$5 = (unsigned char **) 0x0
(gdb) print *dst
Cannot access memory at address 0x0
(gdb) print dst
$6 = (unsigned char **) 0x0
(gdb) 

maybe the last part of the els if line should be ptr != dst instead of ptr != 
*dst ?

cheers,
Sebastian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]