From patchwork Tue Dec 26 22:24:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 6989 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.79.195 with SMTP id r64csp7348421jad; Tue, 26 Dec 2017 14:25:04 -0800 (PST) X-Google-Smtp-Source: ACJfBosJaWdFePMTjutBAZEQfnMhAHbErjV0uX/CEtLu46AfHWCvrF8Z6FxnT4btTjtF/1C3BhHR X-Received: by 10.223.141.226 with SMTP id o89mr26446666wrb.95.1514327104598; Tue, 26 Dec 2017 14:25:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514327104; cv=none; d=google.com; s=arc-20160816; b=XT37kaboBq1b+BWEoQF2+btLW23yKiCYabu7GipQUEGdKXbGTJvXHItWsSjTsZg9Di rO0H5JfyzsJJSk97j2FUCr2WGaJhYJXk44klAww3vq6DjEXz39ekTL+97eX+lRRCjVSN MyXzpI80pyxGpuPrNZ4t+YyzY+S+vVJZFdPf8Tfuu+XJUhw2YNybCZ5CsYuGV1zN/Gvp Je8v+PZIglZ5iOSrAVQdoLTyrvYMHw8CGKMnPANIImn11GSiDDBDrBseM6fiSzGUj1ow 5Gkt1AUIu9k62h9uz+5kzWOq1UbvsyFLAxTnQ4lBkKmVHHt7ejN+dThOmM5O9aOAIuxW rlng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=Ep/nPxezQlpnSyIMcxZBivS5tf8yqJbTw7WyJEdmnBk=; b=HrD3CKplImv+2vh/ddi17nvNxf7XqPYT9YRVv2sYztlGwH1giJarfIZdMrq/RkL3jo AnOma8OG4891Tw1TPP9dmdKaBoqWxiYgmCkPcXiUGbz6xdNsumJ90AUvFlYpc6KR9Mhb yp7SsGam+rrHBFRLiGrLeW0bzon9ULBUuz1mbuTBgRzTqttLXEBigr4O+OnJ3EPVvgoA ibFlwGzqk+euL/SWOo8Cv2h+Tf3JodeOWznDlXYuNYuy0DnWunOYHW3imTO5U7iaT+lH YUB4/HdH5z0jA6vrmwPPpWUcNdKWNrV0khgP4FVHm6RRBw50XR6MOzujgR2L3QgxhCpv S0Rw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m142si12577850wmb.264.2017.12.26.14.25.04; Tue, 26 Dec 2017 14:25:04 -0800 (PST) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 351FC68836C; Wed, 27 Dec 2017 00:24:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-3.mx.upcmail.net (vie01a-qmta-pe02-3.mx.upcmail.net [62.179.121.183]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5A9A5687989 for ; Wed, 27 Dec 2017 00:24:42 +0200 (EET) Received: from [172.31.218.40] (helo=vie01a-dmta-pe04-1.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eTxeZ-00009V-Mc for ffmpeg-devel@ffmpeg.org; Tue, 26 Dec 2017 23:24:55 +0100 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eTxeY-0002Sz-SA for ffmpeg-devel@ffmpeg.org; Tue, 26 Dec 2017 23:24:54 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id qmQo1w01W0S5wYM01mQpZW; Tue, 26 Dec 2017 23:24:49 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 26 Dec 2017 23:24:45 +0100 Message-Id: <20171226222445.20277-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171226222445.20277-1-michael@niedermayer.cc> References: <20171226222445.20277-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/hevcdsp_template: Fix Invalid shifts in put_hevc_qpel_bi_w_h() and put_hevc_qpel_bi_w_w() 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes: left shift of negative value -1 Fixes: 4690/clusterfuzz-testcase-minimized-6117482428366848 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/hevcdsp_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c index 903aa3fe95..56cd9e605d 100644 --- a/libavcodec/hevcdsp_template.c +++ b/libavcodec/hevcdsp_template.c @@ -915,7 +915,7 @@ static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint for (y = 0; y < height; y++) { for (x = 0; x < width; x++) dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + - ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); + ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1)); src += srcstride; dst += dststride; src2 += MAX_PB_SIZE; @@ -970,7 +970,7 @@ static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint for (y = 0; y < height; y++) { for (x = 0; x < width; x++) dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + - ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); + ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1)); src += srcstride; dst += dststride; src2 += MAX_PB_SIZE;