From patchwork Wed Jan 22 14:52:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 17471 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2619544B987 for ; Wed, 22 Jan 2020 17:00:11 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0C8EF68B361; Wed, 22 Jan 2020 17:00:11 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 26A4868AF71 for ; Wed, 22 Jan 2020 17:00:04 +0200 (EET) Received: by mail-wm1-f67.google.com with SMTP id 20so7506643wmj.4 for ; Wed, 22 Jan 2020 07:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ElRvesYQrOMc2uNDYUPueAm6ACnP8eXtt4ftLvTk0N4=; b=hd2Xu9ijKRf32H5daYCxxXWI8KVEpv0VQk92DbROlvfDim4PVv68+dlzdUcg2FaOJm K4d/+sLZ+3Cl4SjPx5FstgmKx2Ts8dMFprVlFcRKOtCOaZ6iWBNebJy5qezP/tT+aP3X taFbtGIWxRyh8Q9Jg6jl9M1PyE2EvlsPtPRfLuuylDoOMqjdbLkPD3COfkr+l238AYIC NMfSfBDiGMgij/QVxCZL24PQcyBK7eIUwqawUmNovKJqn0Qk3wlnTuXv1CcbLyGg1SE2 ZMbaPQslSIebI0Sz0uM8FLY9T+YhzvkJSx2ZFrxhDVFiIGUtFlMoNrcDtvP5byiuIIaD FRIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ElRvesYQrOMc2uNDYUPueAm6ACnP8eXtt4ftLvTk0N4=; b=r5ML/d4DyJhYYcqhqyWod8u6N9YtDfFk0oNceqkJc+0wSlSGEKztqZYMfOMK/ioeam o3GlPqbkKV9qHQrrFwTxGxGCb+QAlyu67tCLLy0fWzuq87UvM+HqrT0B6u1XOVn7v0T4 BXpZ101izja1SYxtpgKaDjDalo1ZARUtrNXAc0bPEWmeVYy5UJ97kHWNdcRipoM3JDnP vEhmqPnltcgGOirCtugpeOr6MJhs5nsc2NAgu4DTuuT8WYAAavIAuAyTkjVsFM9pIlLU GHXDA6roDzh3hTZd/dslbfaGO5zPPs0B1If7rwf2Zm96w3dV49zyCLVGhmGo++BIkYYz q6ZA== X-Gm-Message-State: APjAAAWXa7e6ZmV7O4d2sD1lzSEIGjPKuVWJgpUm5bpizvy2EK6oIYv4 xtVcQ2YxX7d1PFXLB8WvctwTUJda X-Google-Smtp-Source: APXvYqwJ1l8Dp3jNcEF5C7GSwph3yD+HKtfn1G+NI8UEXUj8ve9tPfxQpYGMf4xzKmyJKOTu3kzGCg== X-Received: by 2002:a05:600c:211:: with SMTP id 17mr3401052wmi.60.1579705203524; Wed, 22 Jan 2020 07:00:03 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08bbf.dynamic.kabel-deutschland.de. [188.192.139.191]) by smtp.gmail.com with ESMTPSA id t81sm4452092wmg.6.2020.01.22.07.00.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 07:00:03 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 Jan 2020 15:52:10 +0100 Message-Id: <20200122145210.6898-4-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200122145210.6898-1-andreas.rheinhardt@gmail.com> References: <20200122145210.6898-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] avcodec/ra144enc: Fix invalid left shift of negative number 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" by replacing it with a multiplication. Said multiplication can't overflow an int32_t because lpc_coefs is limited to 16 bit precision. Fixes the FACE-test acodec-ra144 as well as part of #8217. Signed-off-by: Andreas Rheinhardt --- I am unable to reproduce the division by zero mentioned in ticket #8217; probably just an error on the reporter's part. libavcodec/ra144enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c index cc4f381606..059f582334 100644 --- a/libavcodec/ra144enc.c +++ b/libavcodec/ra144enc.c @@ -477,8 +477,8 @@ static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, LPC_ORDER, 16, lpc_coefs, shift, FF_LPC_TYPE_LEVINSON, 0, ORDER_METHOD_EST, 0, 12, 0); for (i = 0; i < LPC_ORDER; i++) - block_coefs[NBLOCKS - 1][i] = -(lpc_coefs[LPC_ORDER - 1][i] << - (12 - shift[LPC_ORDER - 1])); + block_coefs[NBLOCKS - 1][i] = -lpc_coefs[LPC_ORDER - 1][i] + * (1 << (12 - shift[LPC_ORDER - 1])); /** * TODO: apply perceptual weighting of the input speech through bandwidth