HylaFAX The world's
most advanced open source fax server
|
|
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
pagesend -- Bug in StackBuffer
- Pardon me if this my exlanations are not always clear, but this is the
first time I looked at C++ code...
- My environment:
- Hylafax 4.0 pl2
- gcc: egcs-2.90.29 980515 (egcs-1.0.3 release)
- Linix 2.0.34
- Modem Xircom PCMCIA (class 1)
- Problem:
SIGSEV in pagesend after (successfully) sending ucp page
- Dignostic:
the problem can be easily reproduced with the following piece of
code:
int
main(int argc, char** argv)
{
fxStackBuffer tmp;
fxStackBuffer buf;
buf.put("azertyuiopazertyuiopazertyuiop");
tmp.put("azertyuiopazertyuiopazertyuiop");
buf = tmp;
}
What's happening? actually, after the 'buf = tmp', we have
buf.buf contains the same value than tmp.buf
buf.base == tmp.base == tmp.buf
so the destructor for fxStackBuffer tries free() something which
cannot be freed (tmp.buf) --look at StackBuffer.c++ /
fxStackBuffer::~fxStackBuffer()
Solution: the following pagesend hack fixes the problem (note that this
piece of code only impacts UCP pagers):
-- Phil.
*** pageSendApp.c++.ori Sat Feb 14 11:49:44 1998
--- pageSendApp.c++ Sat Jul 25 23:10:16 1998
***************
*** 1069,1075 ****
addUcpChecksum(tmp); // append packet checksum
tmp.put("\x03");
! buf = tmp;
/*
* Send the packet to paging central.
--- 1069,1078 ----
addUcpChecksum(tmp); // append packet checksum
tmp.put("\x03");
! // buf = tmp;
! // this gives problem with the destroy :-) VHD
! buf.reset(); // VHD
! buf.put(tmp); // VHD
/*
* Send the packet to paging central.