gnokii-users
[Top][All Lists]
Advanced

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

re: bug #175176, lots of question about nk7110 code


From: Pawel Kot
Subject: re: bug #175176, lots of question about nk7110 code
Date: Tue, 14 Jan 2003 02:28:17 +0100 (CET)

On Mon, 13 Jan 2003, Peter Gervai wrote:

Hi Peter,

> Zeroth fact: I'm using the source from debian, and I'm commaneting on it. If
> there is any significant diff between the release code and that please
> forgive me. If you want me to test any different version just ask, but
> please bear in mind that I already spent too much time on that (I'm short on
> time), and uncompilable versions won't help.

The most recent version is usable. If you don't want to use CVS snapshot
there is still 0.5.0pre4 version which is quite up-to-date.

> First, I wasn't able to compile a debug version because I think:
>
> --- c   2002-08-05 18:21:21.000000000 +0200
>  +++ configure   2003-01-13 15:10:41.000000000 +0100
>  @@ -1274,7 +1274,7 @@
>   fi
>
>  -if test -n "$CFLAGS"; then
>  +if test -z "$CFLAGS"; then
>          CFLAGS="-O2 -Wall"
>   fi

Configure script is not the one to fix. configure.in is the right one.
Anyway I think this was fixed some time ago -- I can't find the similiar
thing in the current snapshot.

> After that at least I can debug. I have a full debug of the problem I
> mentioned in the debian bugreport, which can bet retrieved from there:
> http://bugs.debian.org/cgi-bin/bugreport.cgi/crash1.log.gz?bug=175176&msg=7&att=0

Thanks. I will analize it during next few days. Sorry that it will take so
long, but I was flooded with bug reports last days and as I can afford
only 2-3 hours a day on real gnokii work (excluding email answering), It
takes time...

> The path is probably not that impossible after all.

This one really looks better. In the previous bactrace you had both nk7110
driver functions and at siemens driver.

> Then I tried to get done what I wanted and read the damned calendar with
> xgnokii. It doesnt work. After checking the code, it seems no wonder:
>
> --- n   2002-08-05 18:21:20.000000000 +0200
> +++ nk7110.c    2003-01-13 20:13:14.000000000 +0100
> @@ -1496,8 +1496,13 @@
>                 data->CalendarNotesList->Number = (message[4] << 8) + 
> message[5];
>                 dprintf("Location of Notes: ");
>                 for (i = 0; i < data->CalendarNotesList->Number; i++) {
> -                       data->CalendarNotesList->Location[i] = (message[8 + 2 
> * i] << 8) | message[9 + 2 * i];
> -                       dprintf("%i ", data->CalendarNotesList->Location[i]);
> +                       dprintf("%i (%i)", 
> data->CalendarNotesList->Location[i], i);
> +                       if( (9 + 2 * i) <= length ) {
> +                               data->CalendarNotesList->Location[i] = 
> (message[8 + 2 * i] << 8) | message[9 + 2 * i];
> +                       } else {
> +                               dprintf("ERR!");
> +                               data->CalendarNotesList->Location[i] = 0;
> +                       }
>                 }
>                 dprintf("\n");
>                 break;
>
> Without understanding the code, seems it wasn't bound checked and 'message[8
> + 2 * i]' was segfaulting because it's not that nice to read the 1100th 
> element
> from a 208 length array. (first number varies)

Ouch, there's rather some off-by-one or dumb logic error. Thanks for
spotting, I'll test this.

> (@@ lines are my own debugging of the memory allocation) So as far as I see
> (which is not much knowing existence of gnokii for 4 hours already) calendar
> would like to send 660 entries and gnokii see 208 bytes in the packet, which
> seems to be quite few. I suspsect either the protocol is not well known, or
> gnokii handles something terribly lazy, but the largest packet I saw is 208
> bytes (to be honest ALL calendar packets were 208 long), and this means
> after I pacthed the segfault gnokii cannot get calendar entry higher than
> 100 or so.

Thanks for your time on investigating the issue. It definitely looks
suspected. I'm gonna spend the next evening on this issue.

pkot
-- 
mailto:address@hidden :: mailto:address@hidden
http://kt.linuxnews.pl/ :: Kernel Traffic po polsku





reply via email to

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