--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: pu: package portmidi/1:184-2
- From: Alessio Treglia <alessio@debian.org>
- Date: Thu, 27 Dec 2012 02:12:55 +0000
- Message-id: <20121227021255.4203.65469.reportbug@Aspire-1410>
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: pu
Hi,
after having fixed #695842 in unstable (BTW, thanks for the
unblock!) I'be glad to see the same bug fixed in Squeeze too.
I'm attaching a debdiff, thanks for considering.
Regards,
--
Alessio Treglia | www.alessiotreglia.com
Debian Developer | alessio@debian.org
Ubuntu Core Developer | quadrispro@ubuntu.com
0416 0004 A827 6E40 BB98 90FB E8A4 8AE5 311D 765A
diff -u portmidi-184/debian/changelog portmidi-184/debian/changelog
--- portmidi-184/debian/changelog
+++ portmidi-184/debian/changelog
@@ -1,3 +1,16 @@
+portmidi (1:184-2+squeeze0.1) stable; urgency=low
+
+ * Non-maintainer upload.
+ * debian/patches/11-pmlinuxalsa.patch:
+ - Avoid SIGSEGV when it receives data for devices which
+ might have already been closed. (Closes: #695842)
+ - Fix some other pointer issues:
+ + alsa_in_close() didn't clear midi-descriptor.
+ + Some other uses of midi->descriptor didn't do NULL-check of
+ the pointer.
+
+ -- Alessio Treglia <alessio@debian.org> Thu, 27 Dec 2012 02:03:12 +0000
+
portmidi (1:184-2) unstable; urgency=low
* Add -lpthread to ALSALIB (closes: #556070)
diff -u portmidi-184/debian/patches/series portmidi-184/debian/patches/series
--- portmidi-184/debian/patches/series
+++ portmidi-184/debian/patches/series
@@ -8,0 +9 @@
+11-pmlinuxalsa.patch
only in patch2:
unchanged:
--- portmidi-184.orig/debian/patches/11-pmlinuxalsa.patch
+++ portmidi-184/debian/patches/11-pmlinuxalsa.patch
@@ -0,0 +1,70 @@
+Subject: Prevent SIGSEGV on handling events for already closed devices.
+Bug: http://sourceforge.net/apps/trac/portmedia/ticket/3
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695842
+Bug-Ubuntu: https://launchpad.net/bugs/1073484
+Applied-Upstream: yes
+---
+ pm_linux/pmlinuxalsa.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- portmidi-184.orig/pm_linux/pmlinuxalsa.c
++++ portmidi-184/pm_linux/pmlinuxalsa.c
+@@ -193,6 +193,7 @@ static PmError alsa_write_byte(PmInterna
+ snd_seq_event_t ev;
+ int err;
+
++ if (!desc) return pmBadPtr;
+ snd_seq_ev_clear(&ev);
+ if (snd_midi_event_encode_byte(desc->parser, byte, &ev) == 1) {
+ snd_seq_ev_set_dest(&ev, desc->client, desc->port);
+@@ -339,6 +340,7 @@ static PmError alsa_in_close(PmInternal
+ pm_hosterror = snd_seq_delete_port(seq, desc->this_port);
+ }
+ alsa_unuse_queue();
++ midi->descriptor = NULL;
+ pm_free(desc);
+ if (pm_hosterror) {
+ get_alsa_error_text(pm_hosterror_text, PM_HOST_ERROR_MSG_LEN,
+@@ -433,6 +435,7 @@ static PmError alsa_write(PmInternal *mi
+ static PmError alsa_write_flush(PmInternal *midi, PmTimestamp timestamp)
+ {
+ alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
++ if (!desc) return pmBadPtr;
+ VERBOSE printf("snd_seq_drain_output: 0x%x\n", (unsigned int) seq);
+ desc->error = snd_seq_drain_output(seq);
+ if (desc->error < 0) return pmHostError;
+@@ -448,6 +451,7 @@ static PmError alsa_write_short(PmIntern
+ PmMessage msg = event->message;
+ int i;
+ alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
++ if (!desc) return pmBadPtr;
+ for (i = 0; i < bytes; i++) {
+ unsigned char byte = msg;
+ VERBOSE printf("sending 0x%x\n", byte);
+@@ -481,6 +485,10 @@ static void handle_event(snd_seq_event_t
+ {
+ int device_id = ev->dest.port;
+ PmInternal *midi = descriptors[device_id].internalDescriptor;
++ /* The device we received events for might have been closed before we
++ processed them. */
++ if (!midi)
++ return;
+ PmEvent pm_ev;
+ PmTimeProcPtr time_proc = midi->time_proc;
+ PmTimestamp timestamp;
+@@ -650,6 +658,7 @@ static PmError alsa_poll(PmInternal *mid
+ static unsigned int alsa_has_host_error(PmInternal *midi)
+ {
+ alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
++ if (!desc) return 0;
+ return desc->error;
+ }
+
+@@ -657,6 +666,7 @@ static unsigned int alsa_has_host_error(
+ static void alsa_get_host_error(PmInternal *midi, char *msg, unsigned int len)
+ {
+ alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
++ if (!desc) return;
+ int err = (pm_hosterror || desc->error);
+ get_alsa_error_text(msg, len, err);
+ }
--- End Message ---