From patchwork Wed Sep 18 03:26:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 15134 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 7F12B449FBC for ; Wed, 18 Sep 2019 06:32:46 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6B423689956; Wed, 18 Sep 2019 06:32:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B6AC96898D8 for ; Wed, 18 Sep 2019 06:32:37 +0300 (EEST) Received: by mail-wm1-f65.google.com with SMTP id r195so692597wme.2 for ; Tue, 17 Sep 2019 20:32:37 -0700 (PDT) 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=TPwaTy6rQg/y5x/4DTno5NRiS8yF9Jpk+z63+I7u5L0=; b=KJgeTWbHq6Uv/MNPZ0IW3ck02Y0fX1xHOWO967miyLuEqNmJ/4paNlSjjxZ1f/eyFA QZn9dVLkdphd/cXKJWdlpwZtxtjdIhlMSaBDoW86icCi+M7anzEtHg1GDiTw0KSHNuWg AgJ7Xog1S6Wv7yPcADaARicgeG48rVJDpZP2+a1DbSB6xM+VlpsiKv8AUvQyZHFnLHW0 HPpsocK/gvYSLmOOgpMvl/AJ48eyi8LjxnXUgx80+uKp5/iAVnk8mrXy3DIPXffgtBDr DQ08g2RgjKiVsJPbsbWCos2VWASrC5MNdW0bGhFrSJdANvENgPNGE9A3t3SCNS/MxFWn wZIA== 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=TPwaTy6rQg/y5x/4DTno5NRiS8yF9Jpk+z63+I7u5L0=; b=Cgzy6a02x6AcKYH9OMdloNiwYQVgMc2eea15eHtxXKYLo4lM72tZnG/yfQdB1xlmsA jUJEGBq0YELgPXRfBtiqeZrPin7zXmT//GjTc9AB4sdAmHEfeRyMCsE4WEdzf7pflqKP 8cz9Q6gvhQTUoT4+5e69sESTQUjr5fFGt2rCkDBOq0QdakM8/GiKYY3SxX73CCzLPHRX m16B2GtMqTDUT9B1Bo/C/RNkU87PuU6l2Mb0FNsCURwk6JPoSrOdllbmdhOJocNLMKN+ cEZ3/lOcb9GjctamUyP/GVkhMKLd26Xy2T7Ppysc+9g4pxDJoHjlj3yjpQ0RotJE9qHR nsyA== X-Gm-Message-State: APjAAAVahpooBPG5syD6O7cMripGQ1+YT6OHJa9ZAHVMSOd6tr5h+3dE YmhkPgYFozImEdGFWkFAHhJky/so6oQ= X-Google-Smtp-Source: APXvYqwY0p982g/45xbsbtvEjf2JBIVLrk1BMvvwQzxIb6/dkCQzTtEVtNgbVkQeqHAASXHT0GmZQQ== X-Received: by 2002:a1c:29c4:: with SMTP id p187mr929519wmp.28.1568777557087; Tue, 17 Sep 2019 20:32:37 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc0f857.dynamic.kabel-deutschland.de. [188.192.248.87]) by smtp.gmail.com with ESMTPSA id 189sm806891wmz.19.2019.09.17.20.32.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2019 20:32:36 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 18 Sep 2019 05:26:07 +0200 Message-Id: <20190918032607.11774-10-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190918032607.11774-1-andreas.rheinhardt@gmail.com> References: <20190918032607.11774-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/10] avutil/common: Fix undefined shift 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" av_mod_uintp2_c uses a bitwise AND with (1 << p) - 1 to clear the high bits of an unsigned int. But this is undefined if p == 31, because 1 is an int and 2^31 is not representable in an int. So make 1 unsigned. Signed-off-by: Andreas Rheinhardt --- libavutil/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/common.h b/libavutil/common.h index 8db0291170..af35397eb9 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -240,7 +240,7 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) */ static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) { - return a & ((1 << p) - 1); + return a & ((1U << p) - 1); } /**