Another Packet_scanf bug?

All your MAngband related technical questions answered. Problems compiling or running the game/server? No problem! Ask here.
Post Reply
silicontrip
Human Zombie
Posts: 28
Joined: Sun 12.12.2010, 23:26
Location: Melbourne, Australia
Contact:

Another Packet_scanf bug?

Post by silicontrip » Mon 07.02.2011, 02:38

I tried building the 1.1.2 source on power pc OSX and discovered that it crashes upon login.

I've tracked this down to a section of code in netclient.c to do with the number of repetitions. Near the comment "Draw a character n times"

The packet_scanf is told to read a single byte "%c", however it's stored in a int and I've seen that it returned a large value >255.

I put a work around in by ANDing it with 255 but I've noticed a number of other issues, such as not being able to select a spell book when casting a spell, inventory updates occur very slowly with Identify or Selling items. I'm suspecting this is due to packet_scanf issues.

Could all these be packet_scanf related?

Cheers
Mark
--
Project Mangband OSX Carbon Developer.

silicontrip
Human Zombie
Posts: 28
Joined: Sun 12.12.2010, 23:26
Location: Melbourne, Australia
Contact:

Re: Another Packet_scanf bug?

Post by silicontrip » Mon 07.02.2011, 04:44

I've checked through the Packet_scanf function and it appears to be ok.

It's told to read a character "%c" and it is stored in an int. Obviously the old data in the int is not overwritten.

I forgot to mention that it was in the Receive_objflags function.
I looked through the rest of the netclient code and it appears that Receive_objflags is the only function that declares variable n as an int, when using Packet_scanf to read a character into n.

I assume this is a bug in Receive_objflags, declaring n as an int and not a char like the other functions. I don't see any reason it should be declared as an int.

I'll test this change on my PPC OSX machine when I get home.
Mark
--
Project Mangband OSX Carbon Developer.

PowerWyrm
Balrog
Posts: 1574
Joined: Sun 27.11.2005, 15:57

Re: Another Packet_scanf bug?

Post by PowerWyrm » Mon 07.02.2011, 12:16

http://mangband.org/developer/ticket/855

This bug was fixed for 1.2, check the bug database for the proper fix.

silicontrip
Human Zombie
Posts: 28
Joined: Sun 12.12.2010, 23:26
Location: Melbourne, Australia
Contact:

Re: Another Packet_scanf bug?

Post by silicontrip » Mon 07.02.2011, 21:22

Where is 1.2? I've only seen a release for 1.1.2 and the svn branch for 1.1.3 and trunk.
--
Project Mangband OSX Carbon Developer.

Post Reply