From patchwork Sun Jun 30 23:47:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 13783 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 7984B449D66 for ; Mon, 1 Jul 2019 02:48:06 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 529356899BA; Mon, 1 Jul 2019 02:48:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D76546883A9 for ; Mon, 1 Jul 2019 02:47:59 +0300 (EEST) Received: by mail-io1-f67.google.com with SMTP id s7so24551337iob.11 for ; Sun, 30 Jun 2019 16:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=5LGPbhI1xVfa5u5RsjxxjuEYlk62bY0bOw7ce6A/C2M=; b=pdMulTGJ5jfv0jp+KYMAZqWYbksldaUF98zH6BhEXFtg12eueyfO9YYWd4jPU5EflW xi+QCl3GQFol9SrawWx3mMk0srUH4XC9aleY6xbFxdc9OuHbUyvsbwTfGog6E7y3zpoJ KYDPfNU3WUxIC5d3stx5U7N5HhMUccAxIEt3ZpnR5aCy4dgnBephR8M0iWhT9mEV6YNg ddzzUiL3ifLVAW9ClZnlMSgB0QY2BEdJv49gV8dlKCs0Aj0msxFP9my1cg738nYZAmnV NIL/4YCOVkqQ4ahSHOMW5+vNRL9XDStg4HaRq0wZzk4ddpBdgduT7Sxif9dXzTnvOeGP D+BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=5LGPbhI1xVfa5u5RsjxxjuEYlk62bY0bOw7ce6A/C2M=; b=fLRPg34RwABVATCH4q2M+ZDD8aZ8mttnV3ha+Py6W6uDez0B0Puu3+bWKerxdxSsHs zVHk2Z1upvHDn98RbrRdxvLeuMRr7KUDItzyxrAJxx0ROx3a3hPmJdNobg2I13kx0Wei x2oMVaUB8/9OHECT9p0bJaKQj7CMm23ycMuorOJjTTeJKq+FA/Gpjl0A1yYPhGplEZQa 4wC3P1YUUEJzkc6ohVR5Wxc/lpPpUmVZv+fJtQDD0nN3FPmXhqcVuDqxcVPensr9Xrie JaXH/x1GlajnBpltvH3mhQgbg2HJT7IOw2WGwuvmo6TpPWYQduHRRHHrS4XoPemwgLoS glVg== X-Gm-Message-State: APjAAAU2pXqPyYGyCplpXJLn+CxoaYPQcTncEQPzKZe5sD6cOMvKExbn LmWzCZnWZznQsoDFT6xyhWm5/7BRq06lqL9LXP0ybA== X-Google-Smtp-Source: APXvYqxCyY/nQg2rCbJCqNx/4g61aEfxWPu/sGlgX8cZq6sPKaO6MswtjcPRHfSrBhHkEaN/1+11+Bk1Aacu9BAprF8= X-Received: by 2002:a5d:9047:: with SMTP id v7mr18869698ioq.18.1561938478363; Sun, 30 Jun 2019 16:47:58 -0700 (PDT) MIME-Version: 1.0 From: Carl Eugen Hoyos Date: Mon, 1 Jul 2019 01:47:46 +0200 Message-ID: To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH]lavc/zmbvenc: Do not left-shift negative values 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" Hi! Attached patch fixes the only (remaining) issue I see with the sample of ticket #7980. Please comment, Carl Eugen From e6ff8f43c0d92733335b52290e18231438ce7770 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 1 Jul 2019 01:45:36 +0200 Subject: [PATCH] lavc/zmbvenc: Do not left-shift negative values. Fixes the following ubsan errors with the sample from ticket #7980: libavcodec/zmbvenc.c:243:29: runtime error: left shift of negative value -4 libavcodec/zmbvenc.c:244:28: runtime error: left shift of negative value -2 --- libavcodec/zmbvenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c index 48871758e0..0e22ce687f 100644 --- a/libavcodec/zmbvenc.c +++ b/libavcodec/zmbvenc.c @@ -240,8 +240,8 @@ FF_ENABLE_DEPRECATION_WARNINGS tprev = prev + x * c->bypp; zmbv_me(c, tsrc, p->linesize[0], tprev, c->pstride, x, y, &mx, &my, &xored); - mv[0] = (mx << 1) | !!xored; - mv[1] = my << 1; + mv[0] = (mx * 2) | !!xored; + mv[1] = my * 2; tprev += mx * c->bypp + my * c->pstride; if(xored){ for(j = 0; j < bh2; j++){ -- 2.22.0