summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2020-12-10 17:30:50 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2020-12-10 17:30:50 +0000
commit58548b5f3cc2920b93bc4718a839a6b7003b3a80 (patch)
tree99c1c04ec6795ae6a091e00787c10b94ed893441 /usr.bin
parente8bf6be02c8f7cbbf2d8689fdbf8d0e42f2963b8 (diff)
Check sample signedness when setting up format conversions.
Fixes confusion between s16 and u16 found in aucat by James Cook.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/sndiod/dsp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/sndiod/dsp.c b/usr.bin/sndiod/dsp.c
index a2998d2c579..0f0c21afc86 100644
--- a/usr.bin/sndiod/dsp.c
+++ b/usr.bin/sndiod/dsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsp.c,v 1.14 2018/09/18 06:05:45 miko Exp $ */
+/* $OpenBSD: dsp.c,v 1.15 2020/12/10 17:30:49 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -192,7 +192,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);
}