#293 datatype mismatch in _mysql_ConnectionObject_kill

MySQLdb-1.2
closed
MySQLdb (285)
5
2012-09-19
2009-11-23
Tom Lane
No

In MySQL-python-1.2.3c1, _mysql_ConnectionObject_kill() contains

unsigned long pid;

if (!PyArg_ParseTuple(args, "i:kill", &pid)) return NULL;

which is wrong and will produce seriously incorrect behavior on any 64-bit big-endian architecture. (It might work by chance on little-endian.)

My inclination is to change to "l:kill" (letter ell). Another possibility is "k" to exactly match the unsigned long variable, but that will fail in pre-2.3 Python,
and doesn't really seem to offer much that "l" wouldn't. Or you could change the variable to int, but unsigned long matches mysql_kill so it's probably
best to leave the variable alone and fix the format spec.

Originally reported at https://bugzilla.redhat.com/show_bug.cgi?id=538234

Discussion

  • We only support python >= 2.3, so I'll fix this with "k" shortly. Ignoring signedness and using "l" would just leave a different type of odd behavior to crop up later.

     
  • Change committed to both 1.2br and trunk.

     
  • Fix is in 1.2.3, released.