From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3561 216.34.176.0/20 X-Spam-Status: No, score=-3.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,T_DKIM_INVALID shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 6C6371F42B for ; Thu, 9 Nov 2017 11:46:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1eClHg-0003xO-N2; Thu, 09 Nov 2017 11:46:12 +0000 Received: from sfi-mx-2.v28.ch3.sourceforge.com ([172.29.28.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eClHf-0003x7-MZ for sox-devel@lists.sourceforge.net; Thu, 09 Nov 2017 11:46:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=I180AHlK/2j7I/0QHZpZFX9MzoZ3XQrIC2lZIDoLx10=; b=fmZeFrj5k5AHDTg5w2F91xXZV/ u36W+00CiR3tobdaKEnWoR/YiARa1Bq57WC/7WGQv5cncX4mkivkgCPmMTEZ70uYQH9SKxRUDYyFl sW2DPLifw7CCiRPoHYEYpHuoAiLkLKIv7DpRmCDar7EXpOT8uRcXmB/Div0fZBKQFevo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=I180AHlK/2j7I/0QHZpZFX9MzoZ3XQrIC2lZIDoLx10=; b=FtL1WxB8XOpR3u41nNje7lSIXC hzbmF90nO/zvCG6rcFnvhXkIhul9RET4u6J5vk4iHEjVXAxqVSJwXfnicDZLHbAIr4zcVlOcyWLy/ 71yqYcclr/pFAmkPIuTRcu+OwVnQ0TwDTA3T1TlMKBBBx1o4wQakZzwykiN+nybNIZIw=; Received: from unicorn.mansr.com ([81.2.72.234]) by sfi-mx-2.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) id 1eClHe-0000Cl-9o for sox-devel@lists.sourceforge.net; Thu, 09 Nov 2017 11:46:11 +0000 Received: by unicorn.mansr.com (Postfix, from userid 51770) id 6726315607; Thu, 9 Nov 2017 11:46:03 +0000 (GMT) From: Mans Rullgard To: sox-devel@lists.sourceforge.net Date: Thu, 9 Nov 2017 11:45:54 +0000 Message-Id: <20171109114554.16297-1-mans@mansr.com> X-Mailer: git-send-email 2.15.0 X-Headers-End: 1eClHe-0000Cl-9o Subject: [PATCH] xa: validate channel count X-BeenThere: sox-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sox-devel@lists.sourceforge.net MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: sox-devel-bounces@lists.sourceforge.net A corrupt header specifying zero channels would send read_channels() into an infinite loop. Prevent this by sanity checking the channel count in open_read(). Also add an upper bound to prevent overflow in multiplication. --- src/xa.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/xa.c b/src/xa.c index 81a767720d93..9fc086eca2b2 100644 --- a/src/xa.c +++ b/src/xa.c @@ -143,6 +143,12 @@ static int startread(sox_format_t * ft) lsx_report("User options overriding rate read in .xa header"); } + if (ft->signal.channels == 0 || ft->signal.channels > UINT16_MAX) { + lsx_fail_errno(ft, SOX_EFMT, "invalid channel count %d", + ft->signal.channels); + return SOX_EOF; + } + /* Check for supported formats */ if (ft->encoding.bits_per_sample != 16) { lsx_fail_errno(ft, SOX_EFMT, "%d-bit sample resolution not supported.", -- 2.15.0 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ SoX-devel mailing list SoX-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-devel