gnupic: I'm crashing the GUI in gpsim 0.20.X. Any ideas?


Previous by date: 13 Oct 2001 15:37:59 -0000 Re: I'm crashing the GUI in gpsim 0.20.X. Any ideas?, Ralf Forsberg
Next by date: 13 Oct 2001 15:37:59 -0000 Re: I'm crashing the GUI in gpsim 0.20.X. Any ideas?, Byron A Jeff
Previous in thread: 13 Oct 2001 15:37:59 -0000 Re: I'm crashing the GUI in gpsim 0.20.X. Any ideas?, Ralf Forsberg
Next in thread: 13 Oct 2001 15:37:59 -0000 Re: I'm crashing the GUI in gpsim 0.20.X. Any ideas?, Byron A Jeff

Subject: Re: I'm crashing the GUI in gpsim 0.20.X. Any ideas?
From: Scott Dattalo ####@####.####
Date: 13 Oct 2001 15:37:59 -0000
Message-Id: <Pine.LNX.4.33.0110130804120.10088-100000@ruckus.brouhaha.com>

On Sat, 13 Oct 2001, Ralf Forsberg wrote:

> On Wed, Oct 03, 2001 at 10:30:18PM -0400, Byron A Jeff wrote:
> > However I've run into a problem. I'm using gpsim for testing. It had been
> > working just fine with the GUI until I added/moved quite a bit of code.
> > All of a sudden it starts segfaulting upon startup. Upon debugging I
> > discovered that it was failing on a malloc deep in the C library.
> >
> > But it's flaky. It works fine a time or two then a string of segfaults.
>
> I tried out Electric Fence, and found three bugs.
>
> In eXdbm.c:
> 167c167
> <   DbmDbList = (TDbmDbList *) malloc(sizeof(DbmDbList));
> ---
> >   DbmDbList = (TDbmDbList *) malloc(sizeof(TDbmDbList));
>
>
> For the bugs in gpsim, I made quick hacks. Scott, you should look
> at this:
> In src/cod.cc:
> 462c462
> <       for(offset=0; offset<COD_BLOCK_SIZE; offset += COD_LS_SIZE) {
> ---
> >       for(offset=0; offset<510; offset += COD_LS_SIZE) {

OUCH! That is really a subtle one! COD_LS_SIZE = 6 while COD_BLOCK_SIZE =
512. There are floor(512/6) = 85 COD_LS_SIZE things in one COD_BLOCK. When
offset (which is an index into an array) is equal to 85*6 = 510, we will
access elements beyond the end of the array. I think a better fix will be:

for(offset=0; offset<(COD_BLOCK_SIZE-COD_LS_SIZE); offset += COD_LS_SIZE){

Also, I'll make sure the same thing doesn't happen in gpasm.

>
> In src/pic-processor.cc:
> 1263c1263
> <         files[i].line_seek = new int[files[i].max_line];
> ---
> >         files[i].line_seek = new int[files[i].max_line+1];
>
>  / Ralf

The other changes look fine. Although the fix in eXdbm means that we need
to rev it. (eXdbm is not part of gpsim).


-----

In your previous e-mail Ralf asked what was being done. Well, nothing
exactly. Byron was unable to replicate the problem in a different system
and was going to wait until he finished his code (that was causing gpsim
to exhibit the problem) more before handing me a copy to test.

Incidently, I wouldn't be surprised if the COD fix fixed Byron's segfault
too.

Scott


Previous by date: 13 Oct 2001 15:37:59 -0000 Re: I'm crashing the GUI in gpsim 0.20.X. Any ideas?, Ralf Forsberg
Next by date: 13 Oct 2001 15:37:59 -0000 Re: I'm crashing the GUI in gpsim 0.20.X. Any ideas?, Byron A Jeff
Previous in thread: 13 Oct 2001 15:37:59 -0000 Re: I'm crashing the GUI in gpsim 0.20.X. Any ideas?, Ralf Forsberg
Next in thread: 13 Oct 2001 15:37:59 -0000 Re: I'm crashing the GUI in gpsim 0.20.X. Any ideas?, Byron A Jeff


Powered by ezmlm-browse 0.20.