aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Pages: 1 [2]

Author Topic: Compile error with CVS 20071222  (Read 9673 times)

Attila

  • Jr. Member
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 77
    • Ljubljana Phonology
Re: Compile error with CVS 20071222
« Reply #15 on: December 22, 2007, 05:34:23 PM »

I've managed to compile 20071222 but it's very unstable and crashes shortly after starting up. I'm running Debian Lenny with a .6.22-3-686 kernel and gcc 4.1. I compiled wxALL 2.8.7 from source using the --enable-unicode switch. I then compiled amule with no errors but now I guess the error when running amule from the console:
Code: [Select]
initialising aMule
Checking if there is an instance already running...
No other instances are running.
HTTP download thread started
Loading temp files from /home/xxx/.aMule/Temp.
Loading PartFile 1 of 1
All PartFiles Loaded.
ListenSocket: Ok.

External connections disabled in config file
*** Server UDP socket (TCP+3) at 0.0.0.0:4665
*** TCP socket (TCP) listening on 0.0.0.0:4662
*** Client UDP socket (extended eMule) at 0.0.0.0:4672
Adding file /home/xxx/.aMule/Temp/007.part.met to shares
Empty dir /home/xxx/.aMule/Incoming/ shared
HTTP download thread started
Host: amule.sourceforge.net:80
URL: http://amule.sourceforge.net/lastversion
Response: 200 (Error: 0)
Download size: 6
HTTP download thread ended
Host: emulepawcio.sourceforge.net:80
URL: http://emulepawcio.sourceforge.net/nieuwe_site/Ipfilter_fakes/ipfilter.dat
Response: 302 (Error: 0)
Host: emulepawcio.sourceforge.net:80
URL: http://emulepawcio.sourceforge.net/downloads/get.php?file=ipfilter.dat
Response: 302 (Error: 0)
Host: Auto-select.dl.sourceforge.net:80
URL: http://Auto-select.dl.sourceforge.net/sourceforge/emulepawcio/ipfilter.dat
Response: 302 (Error: 0)
Host: guide.opendns.com:80
URL: http://guide.opendns.com/?url=auto-select.dl.sourceforge.net%2Fsourceforge%2Femulepawcio%2Fipfilter.dat
Response: 200 (Error: 0)
Download size: -1
HTTP download thread ended
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/debug/vector:192:
    error: attempt to subscript container with out-of-bounds index 2, but
    container only holds 2 elements.

Objects involved in the operation:
sequence "this" @ 0x0xb507c0a0 {
  type = N15__gnu_debug_def6vectorIcSaIcEEE;
}
Aborted
I can do a full debug run and post it in the backtrace forum if need be.
Cheers,
Attila
« Last Edit: December 22, 2007, 05:39:56 PM by Attila »
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Compile error with CVS 20071222
« Reply #16 on: December 22, 2007, 06:40:38 PM »

That's a bug in MuleUDPSocket.cpp line 253:
Old:
Code: [Select]
if (GetTickCount() - item.time < UDPMAXQUEUETIME) {
char sendbuffer[packet->GetPacketSize() + 2];
memcpy(sendbuffer, packet->GetUDPHeader(), 2);
memcpy(sendbuffer + 2, packet->GetDataBuffer(), packet->GetPacketSize());

New:
Code: [Select]
if (GetTickCount() - item.time < UDPMAXQUEUETIME) {
std::vector<char> sendbuffer(packet->GetPacketSize() + 2);
memcpy(&(sendbuffer[0]), packet->GetUDPHeader(), 2);
memcpy(&(sendbuffer[2]), packet->GetDataBuffer(), packet->GetPacketSize());

What's happening is a zero sized packed. memcpy works fine if it should copy zero bytes (and does nothing), but with the new code &(sendbuffer[2] fails now.
I've patched it up with
Code: [Select]
if (GetTickCount() - item.time < UDPMAXQUEUETIME && packet->GetPacketSize()) { // otherwise crash on zero sized packets (wherever they may come from)At least it hasn't crashed since.
Personally I do like plain arrays better than complicated classes, and this is a good example why.  ;)
I just hope there aren't more bugs like this, because there are quite some changes of this sort in this version.
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

Attila

  • Jr. Member
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 77
    • Ljubljana Phonology
Re: Compile error with CVS 20071222
« Reply #17 on: December 22, 2007, 08:36:45 PM »

Thanks for that Sturedman. I'll wait a couple of days to see if there are more cases like that.
Cheers,
Attila
Logged

Festor

  • Hero Member
  • *****
  • Karma: 79
  • Offline Offline
  • Posts: 935
  • Offline -> Studying...
Re: Compile error with CVS 20071222
« Reply #18 on: December 23, 2007, 09:34:05 AM »

Note: The problem persists in the 20071223 CVS

GrayFox.i0n

  • Full Member
  • ***
  • Karma: 2
  • Offline Offline
  • Posts: 139
Re: Compile error with CVS 20071222
« Reply #19 on: December 23, 2007, 02:17:46 PM »

Note: The problem persists in the 20071223 CVS

Agreed
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: Compile error with CVS 20071222
« Reply #20 on: December 24, 2007, 10:57:22 AM »

sturedman: I've committed your fix, thanks a lot.
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Compile error with CVS 20071222
« Reply #21 on: December 24, 2007, 12:45:48 PM »

You're welcome!  :D
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Compile error with CVS 20071222
« Reply #22 on: December 24, 2007, 05:21:21 PM »

My bad. The reason the plain arrays were changed to std::vector is MSVC doesn't support variable size in array initializers (and actually ANSI doesn't, either, it's a GCC extension).

Would be cool if someone reviewed it all indeed. I actually need to review this fix, because it might not be right. Thanks anyway!
Logged

Attila

  • Jr. Member
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 77
    • Ljubljana Phonology
Re: Compile error with CVS 20071222
« Reply #23 on: December 24, 2007, 05:43:53 PM »

Thanks Kry. Is there any info I can provide that would be useful? If not I'll shut up and be patient.
Cheers,
Attila
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Compile error with CVS 20071222
« Reply #24 on: December 24, 2007, 06:31:19 PM »

Nto right onw, I'm afraid. Just keep testing!
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Compile error with CVS 20071222
« Reply #25 on: December 25, 2007, 07:11:01 PM »

Would be cool if someone reviewed it all indeed. I actually need to review this fix, because it might not be right. Thanks anyway!
This bug would have slipped past any review because the code refactoring was fine and nobody would have thought of a zero sized packet beforehand probably. The fix is just a patch (literally speaking), the real fix should prevent trying to send zero sized packets.
Thank you for all the great work by the way !  :-*
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon
Pages: 1 [2]