On Tue, 2007-10-16 at 21:46 +0200, Kurt Roeckx wrote:
> tags 446785 + patch
> thanks
> 
> On Tue, Oct 16, 2007 at 12:00:23AM +0100, Francis Tyers wrote:
> > > > 
> > > Program terminated with signal 11, Segmentation fault.
> > > #0  ~ApertiumRE (this=0x7fff00000000) at apertium_re.cc:17
> > > 17        if(!empty)
> > > (gdb) bt
> > > #0  ~ApertiumRE (this=0x7fff00000000) at apertium_re.cc:17
> > > #1  0x00002ad2c9d9e594 in TransferData::writeRegexps (
> > >     this=<value optimized out>, output=0xb2cb20) at transfer_data.cc:185
> > > #2  0x00002ad2c9d9e6e0 in TransferData::write (this=0x7fffe0fa6918,
> > >     output=0xb2cb20) at transfer_data.cc:142
> > > #3  0x00002ad2c9da560d in TRXReader::write (this=0x7fffe0fa68d0,
> > >     [EMAIL PROTECTED]) at trx_reader.cc:328
> > > #4  0x0000000000400f4f in main (argc=<value optimized out>,
> > >     argv=0x7fffe0fa6c28) at transferpp.cc:40
> > > (gdb) p empty
> > > Cannot access memory at address 0x7fff00000000
> > > (gdb) p &empty
> > > $1 = (bool *) 0x7fff00000000
> 
> So, I've been looking at it, and I found a few problems:
> - You're using new char[size] to allocate something
>   but using "delete" instead of delete [] to free it.
> - The same variable can also be allocated by
>   pcre_malloc() but you still "delete" it instead of
>   calling pcre_free().
> - You call pcre_fullinfo() with "what" set to 
>   PCRE_INFO_SIZE, which expects a size_t *, but you pass it
>   an int *.  On 64 bit arches this will of course overwrite
>   things it shouldn't.
> - fwrite() also returns a size_t instead of an int.
> 
> I've solved the first 2 by using pcre_malloc() instead of
> new, which really is what you should be doing.  I think
> you're just lucky that things don't randomly break.
> 
> The other was just replacing int with size_t.
> 
> patch is attached.
> 
> 
> Kurt
> 

It would seem that while this fixes the problem on amd64, it causes a
new problem on ia32. See the bug page here:

http://xixona.dlsi.ua.es/cgi-bin/bugzilla/show_bug.cgi?id=26

For more info. Any more thoughts ?

Fran




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to