Page 1 of 1

Another Packet_scanf bug?

Posted: Mon 07.02.2011, 02:38
by silicontrip
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

Re: Another Packet_scanf bug?

Posted: Mon 07.02.2011, 04:44
by silicontrip
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

Re: Another Packet_scanf bug?

Posted: Mon 07.02.2011, 12:16
by PowerWyrm
http://mangband.org/developer/ticket/855

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

Re: Another Packet_scanf bug?

Posted: Mon 07.02.2011, 21:22
by silicontrip
Where is 1.2? I've only seen a release for 1.1.2 and the svn branch for 1.1.3 and trunk.