summaryrefslogtreecommitdiff
path: root/usr.bin/aucat/dsp.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2020-12-10 17:20:40 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2020-12-10 17:20:40 +0000
commit88716742c61ed081cad856d9487bb771deaa4be7 (patch)
tree82b267fcf825420e3d7d1ecc6f32cfda7193d861 /usr.bin/aucat/dsp.c
parent1f73138cfd81b5cab5a88cc741df9821c50b5127 (diff)
Check sample signedness when setting up format conversions.
Fixes confusion between s16 and u16 found and analysed by James Cook <falsifian at falsifian.org>. Thanks.
Diffstat (limited to 'usr.bin/aucat/dsp.c')
-rw-r--r--usr.bin/aucat/dsp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/aucat/dsp.c b/usr.bin/aucat/dsp.c
index 0ca1f6e20d3..3e8a1006690 100644
--- a/usr.bin/aucat/dsp.c
+++ b/usr.bin/aucat/dsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsp.c,v 1.13 2018/11/07 21:22:34 ratchov Exp $ */
+/* $OpenBSD: dsp.c,v 1.14 2020/12/10 17:20:39 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -262,7 +262,9 @@ aparams_log(struct aparams *par)
int
aparams_native(struct aparams *par)
{
- return par->bps == sizeof(adata_t) && par->bits == ADATA_BITS &&
+ return par->sig &&
+ par->bps == sizeof(adata_t) &&
+ par->bits == ADATA_BITS &&
(par->bps == 1 || par->le == ADATA_LE) &&
(par->bits == par->bps * 8 || !par->msb);
}