From patchwork Sat Mar 27 01:31:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26625 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 232D244BCF5 for ; Sat, 27 Mar 2021 03:31:33 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E4D0C68A17B; Sat, 27 Mar 2021 03:31:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DBCD5687FFA for ; Sat, 27 Mar 2021 03:31:26 +0200 (EET) Received: by mail-ed1-f44.google.com with SMTP id dm8so8300887edb.2 for ; Fri, 26 Mar 2021 18:31:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:mime-version:content-language; bh=ztE7ggM8cfY2zYW1zxpT9I6EAaJptxIyGQ/OBpDkwqk=; b=grj2eoG/3F+eyqTuuMwr42RyUSz3xbMuwnVQd2RmnKfgeCNU7fJXWQQDlfd2nFiicm fNiMH1T+jzmciRu9hgukSRWh8chV9Y5CDZjAi424DIuB+CqLLh+nnZkduPAm+JgOtgWi 3QLekdDnR/2uA6gvNz0e9s+Itu/FvKxD2YdnvWgYG6elPrqImgG9p7Ym4GSEdtzRf7vh 1+1ZqQZlTyciTJFtQEzS1FpgUzNz/4Vi9ncHU4wCwF0/3rbEmweasgdmTOkj5htkwNGn bTY7pnwAhlENvjxm2fmGkErv7Uqapt/zlrh+OehvTmQH8LuDDuRScBxiyhLo7O8GDW3s iPBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:mime-version :content-language; bh=ztE7ggM8cfY2zYW1zxpT9I6EAaJptxIyGQ/OBpDkwqk=; b=QRZDSnS7F9QJQl+1aokMjR94Yuz0xUMOklQmXRS3QMTRoVW/nkLq9QA5Uq5qtFEsH5 CWwamUzVbeh/f3DMXtB84jpr5m9OJQirSDuhBBT3FjdXoFDk2FejMlP88lz2pEIZxUEa gmRgJ+KWeEr3c0We1MX+hBXNa+Db1cQpp9TmWJuQGBKBVklG6punEC90Eg6X77l55kgE bY8lrPID+uonMd6mG4rqCzYuH8sRKcM5/1U1foM/18ubS1nML9ZRATWvJz0Ujd1+J/V8 ckF6fQXqRoT75CunIHhSKtCICORMnu1lfOsdczG+ClTgEySNWKd0AAddxZd5HnFDEEub o+sg== X-Gm-Message-State: AOAM531fWYpxJvb6fEtMTd7L/zpe0kHpzvmFA08ITkxFCmImO9kCy6Y4 Up+YFLoB7gAdlQySFLXRu2PDu1l5+uHF7w== X-Google-Smtp-Source: ABdhPJyFW6ngth5Fu7g/2/LTMFmGapr9TlQNzarWL6I1xnYkdGpDGBBcZkYyu6jh002VhSS0XWAHjw== X-Received: by 2002:a50:f113:: with SMTP id w19mr17744631edl.226.1616808686184; Fri, 26 Mar 2021 18:31:26 -0700 (PDT) Received: from [192.168.50.46] (ipbcc08960.dynamic.kabel-deutschland.de. [188.192.137.96]) by smtp.gmail.com with ESMTPSA id be27sm5045188edb.47.2021.03.26.18.31.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Mar 2021 18:31:24 -0700 (PDT) To: FFmpeg development discussions and patches From: Andreas Rheinhardt Message-ID: <0f494063-0134-9d26-f5eb-07f3661a63a8@gmail.com> Date: Sat, 27 Mar 2021 02:31:23 +0100 MIME-Version: 1.0 Content-Language: en-US Subject: [FFmpeg-devel] [PATCH 00/17] Various undefined behaviour fixes 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" Hello, attached patches fix several instances of undefined behaviour encountered when running the FATE suite. - Andreas Subject: [PATCH 01/17] avcodec/dcaenc: Fix undefined left shift of negative numbers Affected the acodec-dca and acodec-dca2 FATE tests. Signed-off-by: Andreas Rheinhardt --- libavcodec/dcaenc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c index a40d2e0ca0..87fb5f5457 100644 --- a/libavcodec/dcaenc.c +++ b/libavcodec/dcaenc.c @@ -925,10 +925,10 @@ static void fill_in_adpcm_bufer(DCAEncContext *c) * But there are no proper value in decoder history, so likely result will be no good. * Bitstream has "Predictor history flag switch", but this flag disables history for all subbands */ - samples[0] = c->adpcm_history[ch][band][0] << 7; - samples[1] = c->adpcm_history[ch][band][1] << 7; - samples[2] = c->adpcm_history[ch][band][2] << 7; - samples[3] = c->adpcm_history[ch][band][3] << 7; + samples[0] = c->adpcm_history[ch][band][0] * (1 << 7); + samples[1] = c->adpcm_history[ch][band][1] * (1 << 7); + samples[2] = c->adpcm_history[ch][band][2] * (1 << 7); + samples[3] = c->adpcm_history[ch][band][3] * (1 << 7); } } }