From patchwork Fri Sep 9 10:35:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thilo Borgmann X-Patchwork-Id: 490 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp244889vsd; Fri, 9 Sep 2016 03:33:29 -0700 (PDT) X-Received: by 10.194.157.33 with SMTP id wj1mr2703089wjb.154.1473417209623; Fri, 09 Sep 2016 03:33:29 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x7si2338370wjh.272.2016.09.09.03.33.28; Fri, 09 Sep 2016 03:33:29 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@mail.de; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE dis=NONE) header.from=mail.de Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 65BD268A058; Fri, 9 Sep 2016 13:33:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from shout02.mail.de (shout02.mail.de [213.128.151.217]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7672068A058 for ; Fri, 9 Sep 2016 13:33:09 +0300 (EEST) Received: from postfix02.mail.de (postfix02.bt.mail.de [10.0.121.126]) by shout02.mail.de (Postfix) with ESMTP id CA42E60047 for ; Fri, 9 Sep 2016 12:33:19 +0200 (CEST) Received: from smtp02.mail.de (smtp02.bt.mail.de [10.0.121.212]) by postfix02.mail.de (Postfix) with ESMTP id B5EDAC0009 for ; Fri, 9 Sep 2016 12:33:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1473417199; bh=6+1Vme5kfrvVZcXnhfI+7t19PbGxsvd34xWD+pHzVPY=; h=Subject:Reply-To:References:To:From:Date:In-Reply-To:From; b=z7LtQ26t4JKX2pgynqPpS/fk5WRfmL30rbbReBGhY31jbnm0qiS0rk8XDxs0pszTo Q/t+ZmmSQjlqSSNAeWw3jR6uxlZTvpj/PBbvGFNNI8lJZTuYV6289gADKQzZhr/Rsf L26XZ5Fu6m9ScbUsh9E39yN1wvxdkJcJezLzMjss= Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp02.mail.de (Postfix) with ESMTPSA id 79A6E80521 for ; Fri, 9 Sep 2016 12:33:19 +0200 (CEST) References: <20160908202351.C85E31682C9@albiero.videolan.org> <7783b71c-2450-5c60-0840-69cde3361c82@gmail.com> <5363d852-3422-28d8-4f6b-699a84ea4224@mail.de> To: FFmpeg development discussions and patches From: Thilo Borgmann Message-ID: <3e41ba69-9207-c616-f778-5d2591cf18ef@mail.de> Date: Fri, 9 Sep 2016 12:35:45 +0200 MIME-Version: 1.0 In-Reply-To: <5363d852-3422-28d8-4f6b-699a84ea4224@mail.de> X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 3666 X-purgate-ID: 154282::1473417199-0000084F-06A0E213/0/0 Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/alsdec: Fix reading 0 mantisse bits X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Am 09.09.16 um 09:11 schrieb Thilo Borgmann: > Am 08.09.16 um 23:41 schrieb James Almer: >>> ffmpeg | branch: master | Michael Niedermayer | Thu Sep 8 22:02:44 2016 +0200| [037422178d7f1d0dd09e1ce424dd61a69e77668b] | committer: Michael Niedermayer >>> >>> avcodec/alsdec: Fix reading 0 mantisse bits >>> >>> Fixes assertion failure >>> Fixes: 848c24abc1721c9e3d1ba7bfee8d9fcc/asan_heap-oob_1d99eca_3709_567bba70d67e7d62714dcf56f26fb1da.mp4 >>> >>> Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind >>> Signed-off-by: Michael Niedermayer >>> >>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=037422178d7f1d0dd09e1ce424dd61a69e77668b >>> --- >>> >>> libavcodec/alsdec.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c >>> index 1bb71f5..8c4ff53 100644 >>> --- a/libavcodec/alsdec.c >>> +++ b/libavcodec/alsdec.c >>> @@ -1527,7 +1527,7 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) { >>> if (!get_bits1(gb)) { //uncompressed >>> for (i = 0; i < frame_length; ++i) { >>> if (ctx->raw_samples[c][i] != 0) { >>> - raw_mantissa[c][i] = get_bits(gb, nbits[i]); >>> + raw_mantissa[c][i] = nbits[i] ? get_bits(gb, nbits[i]) : 0; >> >> No point changing it now, but keep in mind for future reference that there's a get_bitsz() >> function. It in fact expands to this same code you wrote. > > Thanks! > > Will fix it soon anyway otherwise I will forget about it. Patch attached. Somebody please push, I can not do that from this computer. Thanks, Thilo From 0cdbf565a9b43f8770e77ae2b2b1a0bfb60b0b68 Mon Sep 17 00:00:00 2001 From: Thilo Borgmann Date: Fri, 9 Sep 2016 12:29:23 +0200 Subject: [PATCH] lavc/alsdec: use get_bitsz() to simplify reading of the mantissa --- libavcodec/alsdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 8c4ff53..3986347 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1527,7 +1527,7 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) { if (!get_bits1(gb)) { //uncompressed for (i = 0; i < frame_length; ++i) { if (ctx->raw_samples[c][i] != 0) { - raw_mantissa[c][i] = nbits[i] ? get_bits(gb, nbits[i]) : 0; + raw_mantissa[c][i] = get_bitsz(gb, nbits[i]); } } } else { //compressed