Re: [PATCH] pyalsa: fix integer overflow in alsaseq.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry, here's the patch.

Signed-off-by: Chris Coleman <chris.coleman83 at gmail.com>

2009/8/18 Chris Coleman <chris.coleman83@xxxxxxxxx>:
> Hello alsa-devel,
>
> 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.
>
> Regards,
> Chris Coleman
>
> Signed-off-by: Chris Coleman <chris.coleman83 at gmail.com>
>
--- pyalsa-1.0.20.orig/pyalsa/alsaseq.c	2009-05-06 08:07:28.000000000 +0100
+++ pyalsa-1.0.20/pyalsa/alsaseq.c	2009-08-18 07:08:21.504628168 +0100
@@ -439,7 +439,7 @@ typedef struct {
   ;
 
   /* value of constant */
-  unsigned int value;
+  long value;
   /* name of constant */
   const char *name;
   /* type of constant */
@@ -468,7 +468,7 @@ Constant_create(const char *name, long v
 /** alsaseq.Constant tp_repr */
 static PyObject *
 Constant_repr(ConstantObject *self) {
-  return PyString_FromFormat("%s(0x%x)",
+  return PyString_FromFormat("%s(0x%lx)",
 			     self->name,
 			     self->value);
 }
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux