Bug 538234 - _mysql_ConnectionObject_kill assumes that sizeof(long) == sizeof(int)
Summary: _mysql_ConnectionObject_kill assumes that sizeof(long) == sizeof(int)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: MySQL-python
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Tom Lane
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-11-18 00:13 UTC by Dave Malcolm
Modified: 2013-07-03 03:24 UTC (History)
3 users (show)

Fixed In Version: 1.2.3-0.4.c1.fc12
Clone Of:
Environment:
Last Closed: 2009-12-11 18:28:55 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Dave Malcolm 2009-11-18 00:13:22 UTC
_mysql.c:_mysql_ConnectionObject_kill has this code:
  unsigned long pid;
  int r;
[snip]
  if (!PyArg_ParseTuple(args, "i:kill", &pid)) return NULL;

The 'i' format specifier implies an "int*", not an "unsigned long*".

Are these types guaranteed to be equally sized on every architecture?  (e.g. on a 64-bit big-endian CPU where sizeof(long) == 8 such as s390x, does it leave the 4 most significant bytes of "pid" uninitialized, thus killing random processes?)

Found using an experimental static analysis tool:
http://dmalcolm.livejournal.com/3689.html

Comment 1 Dave Malcolm 2009-11-18 00:14:15 UTC
(see http://docs.python.org/c-api/arg.html )

Comment 2 Tom Lane 2009-11-23 17:55:58 UTC
I agree, this is bogus.  Reported upstream at
https://sourceforge.net/tracker/?func=detail&aid=2902635&group_id=22307&atid=374932

Comment 3 Fedora Update System 2009-11-23 18:46:58 UTC
MySQL-python-1.2.3-0.4.c1.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/MySQL-python-1.2.3-0.4.c1.fc12

Comment 4 Fedora Update System 2009-11-23 18:47:03 UTC
MySQL-python-1.2.3-0.4.c1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/MySQL-python-1.2.3-0.4.c1.fc11

Comment 5 Fedora Update System 2009-11-25 15:09:16 UTC
MySQL-python-1.2.3-0.4.c1.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update MySQL-python'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-12089

Comment 6 Fedora Update System 2009-11-25 15:11:33 UTC
MySQL-python-1.2.3-0.4.c1.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update MySQL-python'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-12101

Comment 7 Kyle VanderBeek 2009-12-08 00:19:04 UTC
I fixed this upstream by using the "k" to correctly unpack into an unsigned long:

http://mysql-python.svn.sourceforge.net/viewvc/mysql-python/branches/MySQLdb-1.2/MySQLdb/_mysql.c?r1=630&r2=634

Comment 8 Fedora Update System 2009-12-11 18:28:50 UTC
MySQL-python-1.2.3-0.4.c1.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2009-12-11 18:29:53 UTC
MySQL-python-1.2.3-0.4.c1.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.