Package: qrq
Version: 0.3.1-1
Severity: normal
Tags: patch

Dear Maintainer,

I'm running qrq using pulseaudio (as is the default on my system).
I've configured the speed to slower than normal, and then goofed quite a bit.
This led to slower and slower speeds and finally to quite reproducible
segfaults.

Investigating, I found that pulseaudio.c reserves a fixed buffer
which is good for 10 seconds.  If a long callsign at slow speed exceeds that
limit, a segfault results.

Fortunately, it is easy to replace the fixed buffer with a dynamically
allocated one that is enlarged dynamically as needed.

Find a patch to this respect included.

Regards, and thank you for providing fine software,

Andreas, DJ3EI.



-- System Information:
Debian Release: 8.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages qrq depends on:
ii  libc6        2.19-18+deb8u4
ii  libncurses5  5.9+20140913-1+b1
ii  libpulse0    5.0-13
ii  libtinfo5    5.9+20140913-1+b1

qrq recommends no packages.

Versions of packages qrq suggests:
pn  gnuplot  <none>

-- no debconf information

Common subdirectories: qrq-0.3.1/.pc and qrq-mine/.pc
Common subdirectories: qrq-0.3.1/OSXExtras and qrq-mine/OSXExtras
Common subdirectories: qrq-0.3.1/debian and qrq-mine/debian
diff -u qrq-0.3.1/pulseaudio.c qrq-mine/pulseaudio.c
--- qrq-0.3.1/pulseaudio.c      2013-01-06 15:14:09.000000000 +0100
+++ qrq-mine/pulseaudio.c       2016-05-30 22:19:03.214507268 +0200
@@ -29,7 +29,8 @@
 extern long samplerate;
 extern void  *dsp_fd;
 
-short int buf[441000];         /* 10 secs buffer */
+short int *buf = 0;
+int bufsize = 0;
 int bufpos = 0;
 
 void *open_dsp () {
@@ -64,8 +65,13 @@
 /* actually just puts samples into the buffer that is played at the end 
 (close_audio) */
 void write_audio (void *bla, int *in, int size) {
+       int sample_count = size/sizeof(int);
        int i = 0;
-       for (i=0; i < size/sizeof(int); i++) {
+       if(bufsize <= bufpos + sample_count) {
+               buf = realloc(buf, (bufpos + sample_count) * sizeof(short int));
+               bufsize = bufpos + sample_count;
+       }
+       for (i=0; i < sample_count; i++) {
                buf[bufpos] = (short int) in[i];
                bufpos++;
        }       

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to