>Synopsis:      sndiod(1) regression, Segmentation Fault on recorging
>Category:      system
>Environment:
        System      : OpenBSD 5.3
        Details     : OpenBSD 5.3 (GENERIC.MP) #62: Tue Mar 12 18:21:20 MDT
2013
                         [email protected]:
/usr/src/sys/arch/amd64/compile/GENERIC.MP

        Architecture: OpenBSD.amd64
        Machine     : amd64
>Description:
        sndiod(1) dies with Segmentation Fault on data recording.
        The bug was introduced in 5.3 release. The crash occurs on line 628
of dsp.c
>How-To-Repeat:
        Run minimal example below.
>Fix:
        unknown

Minimal example:

#include <assert.h>
#include <sndio.h>
#include <stdlib.h>

int
main(int argc, char **argv)
{
        struct          sio_hdl *sio;
        struct          sio_par par;

        int16_t         *buffer;
        size_t          bufsz;

        sio = sio_open(NULL, SIO_REC, 0);       /* record */
        assert(sio);

        sio_initpar(&par);
        sio_getpar(sio, &par);

        bufsz = par.round * sizeof(int16_t);
        buffer = malloc(bufsz);
        assert(buffer);

        sio_start(sio);

        sio_read(sio, buffer, bufsz);   /* sndiod(1) dies here */
        assert(sio_eof(sio) == 0);

        sio_stop(sio);
        sio_close(sio);

        free(buffer);

        return 0;
}

Reply via email to