[Serdev] SER crashing at random locations
Paul Jankowski
paul at teragen.com.au
Tue Mar 22 22:04:01 UTC 2005
> it immediately notified a "Pointer Over-Write" when it invokes a
> sl_send_reply to send a 200 OK to the first REGISTER messages.
>
> int2reverse_hex [Ut.h:224]
> **c= digit >= 10 ? digit + 'a' - 10 : digit + '0';
>
> Anyone seen this before?
No, my SER modules don't have bugs :-) .
Seriously, it's quite unlikely that your problem is caused by the
existing SER code; far more likely that your module has overrun the
bounds of the memory allocated to it.
Look at the definition of int2reverse_hex():
inline static int int2reverse_hex( char **c, int *size, int nr )
It takes a pointer to a pointer of type char, called "c". If that c
points to the wrong place (or if that memory has been accessed using a
broken pointer), your program will malfunction.
In my opinion, there is a bug in your module code that writes to memory
that doesn't belong to it. Note that sl_send_reply is probably a red
herring -- after all, you didn't modify it, did you? Have a look at
http://www.adahome.com/articles/1997-05/bugtales/bugtales.3o4 for a
small sample of similar bugs.
Review your code to make sure that you only write as many bytes as you
have allocated. If possible, have someone else look at your code. The
first time I hit this kind of problem, it took me two days to find the
offending line; I had been allocating four bytes too few in one place
(which just happened to work on Alpha/AXP, due to its strict alignment
rules, but failed when I tried to port to x86).
Have fun,
Paul
--
P-a-u-l- -J-a-n-k-o-w-s-k-i paul at teragen.com.au
"A programmer," he said with obvious amazement, is the sort of person "who
drinks Coke in the morning." -- Boston Globe article on The High Tech Set
More information about the Serdev
mailing list