]> git.alsa-project.org Git - alsa-python.git/commit
pyalsa: fix integer overflow in alsaseq.c
authorChris Coleman <chris.coleman83 at gmail.com>
Fri, 21 Aug 2009 09:52:09 +0000 (11:52 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 21 Aug 2009 09:52:09 +0000 (11:52 +0200)
commit694ac3e27b421e75e28059a31694bdc756e47e7d
tree41f31dfa3e711fcfc03f7da6f42ba1fec994d3dd
parent439c4f859783be859ba3684231aeccdc29da0606
pyalsa: fix integer overflow in alsaseq.c

* Original patch description:

I've been using the alsaseq python module and I found a bug. Sometimes
the SEQ_* constants have extremely large and incorrect values. For
example, 25769803811 instead of 35. The lower 32-bits are always
correct.

Obviously, I'm running a 64-bit operating system.

The problem is that the `value` member of the `ConstantObject`
structure is an `unsigned int` whereas it should be a `long`. I've
attached a patch. It's against the latest released version, 1.0.20.

* Revised patch description:

I just noticed that `PyString_FromFormat` in Python 2.6 doesn't handle
`%lx` in format strings, so my patch breaks `repr(Constant)`.

In addition to that, it was not necessary to change the signedness of `value`.

With those two things in mind, the patch perhaps ought to look like
this (see attached).

Signed-off-by: Chris Coleman <chris.coleman83 at gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
pyalsa/alsaseq.c