From patchwork Fri Sep 30 17:02:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38479 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp1837050pzh; Fri, 30 Sep 2022 10:02:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57/FYJkjqmcaRELJ9FXWidgnDC2OnLH4nIOFCtRykl00qUNj8XC+F/AdBOoFrGS+/jnZ2W X-Received: by 2002:a17:906:ef8c:b0:77c:7b35:8b04 with SMTP id ze12-20020a170906ef8c00b0077c7b358b04mr6785626ejb.573.1664557370975; Fri, 30 Sep 2022 10:02:50 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o14-20020a170906974e00b0077e94a4867csi2388900ejy.796.2022.09.30.10.02.40; Fri, 30 Sep 2022 10:02:50 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=DRYaryVb; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0530F68BBD5; Fri, 30 Sep 2022 20:02:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-oln040092065043.outbound.protection.outlook.com [40.92.65.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A9AEE68BB2E for ; Fri, 30 Sep 2022 20:02:29 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ixxhcKTenLNgzlfOeZsREfGnzhwZSlulW7CYIhKblNoFVGAOKJME2HiGpIXZL/EJ0rZmG/EAbLXrNBhNdokA5SjO/MiT5aVIziLaMkgqw1Lr+3ILvkdhblqTzJYS5hVvEeZusf3h/hKw27PECoODgdHq4MPinRfXYriNjnKKU5WnnLVRxoDkwqc4OsnvPYe8YypnFpjs59aa6v3OqwfkFOA/qlu382mY7ujkeeDxjqRGgw3USbFBnQbZynNS9tb1atFCJe1FC0SHhQxIOQBkfNFVEU/zlAiQvXNCUH92F//mvhaiuHBqnu/3bPq4bfaPNhngVjRcSPWvdKPfCMYGyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=v6xZbkkE/DO6FfVzE9v7XsdNUHlDx9RlBWfO3FkcU5s=; b=Ql+jkmqS5U62/BLdEay14VikV1U5ucmvH21n3XGQx6e9l6v66CLdHMCD8Mqwb9RGzOgYeCD0b+dtc+V6As6c1ogPRl3ebCf6X+dlOSeKH2ovT0EgFsMs8O48LL9Dp2wbEZ02LKeQoPmIG1kIyspHoyoC0YPwdDkqWSTXE3bysUS3d5lEoG8qAuG4mWcKvLoaxbK8kMZfNl9LIFT1gTtKSqrIjlsYEM1l4XRGvtyNDKbVbrGfSuHxbzrbOZTDvGq/TSfNpj5rNJeT4AtxS8VPuY7QHSa4waLSWX1TUnrujlh76lZVUHwtECTyPyw3pgX+3Iv3Kr8OM4zVYLdDpsy97g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v6xZbkkE/DO6FfVzE9v7XsdNUHlDx9RlBWfO3FkcU5s=; b=DRYaryVbaW8c6njwiGMIPPOOlsJh/TWUroWhS9gjLLl9+grK4wxMUjgO4q3faMrdcIE57KNXHAotb77Fp4OfCpquj1aNVptl7cFnvF1IJQ4Pz+cGIm5WB7USz5j2GXNbkSGAp0vZ6t/4PkBAiNywze3Q0QQI1tdlDMInHl1AD9Tvv8eqDvtqQsS27l/G8dI3MBVnXdMARLGtec5FqiHjlakglarAgMbkCCdcCDvVGIqDcnm/Y4L4FqUez5W++tQoD1tv8rsmzNQwpH4J+ND80O2Ogsz7Aba1cKN4UqvB+ObewgZRvVsHR++0xLevsh/d29aMbNq+zCLv0TtVtMazCg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DU2P250MB0175.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:274::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 17:02:27 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8%9]) with mapi id 15.20.5654.025; Fri, 30 Sep 2022 17:02:27 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 30 Sep 2022 19:02:21 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [KB0tGc0I8ZEnHqHqTuYGDknGwquX+P91rB3OcIwCQMY=] X-ClientProxiedBy: FR3P281CA0178.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a0::19) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220930170227.3648162-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DU2P250MB0175:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f495efe-3b98-458d-019a-08daa3058db2 X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKzwu8YPsqYDy2dEXP85Yujlm5jI7azyUJzTyHFgJhCKt0OhlHlVFiqJXi0RtMwv2Dg0sacHUaWCO5vgTSAKrhd5R1pKqk0QXbrfbMvztjt4t6tSapdvWZxGnonsPKo6FK2ngBwGxEZFft14uJYpZmV9NuhynUj3hEbn/bIbQzoUmQ/FzxEqHoj2mQ367d6raF8cN+wnMMUApgyltTliYbL/uX92Q5LaNrY1xEVaJf36/+Lq0llZeb31ntvraqlFwqIQ9MxjgdfQdo5zfbwPRcVHeEIp3vwWWSqhJzDWDUak0GsNrec/HxCLJua85gDuGiv4LI0CsUdS6vZgpHRITCkRxLXdcYsv2XwdcdyjL+Yd5OnDuBKqu5ZxdYCVkwxO3sQwfBIaR/Wn6JQ5BKUvSpkHqPMpzjBXT9vFPFkPB99i2QTBapc2Wf1+1ILl9zz/nnwbd/DsYBse9PHXpBNz24IQujIQz6RZntW+/faxwL4LUYjgCc77YgeXaXKv+CzX/TntKolmlr7i7zBBgAG/BbjAEoJaNvqRSR0zGorFvqx/PhqIPxGnzpFI+NAQsSXiepmEhqotSCR4k+Onscu0OvVJdu5bMQJoPrNbuWqWyNs3hjBWCBjMBH0t7O9bcyaZfgS8eXASSHBVbm8j2W21XPSasTGHMC7CklyfjNBi4k//B6iT3k+AJdc9aSobJ8L+k7SXx6a7QB/yROwBrbpZ46KATgQUFCa9YeQ= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3zWcTGrr1uhQi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QJcVF0ZLwVqOf0KKp2OcSLHSgrwEiqaMhi8Z8gABikLAJ2mXfOkngA5Sm9ZGWCSLnprgSqGC7gY7Hj3EqID0a64am1OOQipZxi95f+oZqEbhZTDrJf4dN486RqS2QZqLTSFljG5WFe9wOfC2XRxwCnTiaQV6QWv3rp3hZNOqi8UijF8aNDOrMX17ugkSs8zARPywnpvzR0SV5Ixp4TkVHVKnjHJ+2utqPQjQ7wyvzs0h9QyRhTh5CfB4XLnv0uDk/tEsHvbBL+eAHGtzFVVA/f4j84VReo2xRREKIkq4X3c7LV/PP/C5zqtF3M6njm12HMlPyY6O3rgMc8K8tn6fXanCLsGAQdEvnejELDYqASAWGE4DZK1Mh04ll/BDVMXJE/E0YgfjOMzBDaioInzA8UcD62+PXA4NSAa9LMtlyPgwp2elZYPbhed5mjosIlYeDLFZMV/DUyh+c07j1e7otSGC9MIItjWeekgcFZLxAJPlkueUDMS8aqbothjciehWiQ2PlDyvDWwEj8Tx96regX+DFkO8/aQCCCHywhzGTX1N8NGND73GneGLiGPzlZzezKeFZ+NmySqzmT5pGiTKD+l3RrUFZhWaNVXZZHaNpk1Jl+Z7CmbJFWqDnzaJPZujQ8QY7XpdiG6WiII2qNN6640cFPKp8m3aWY7XipimgbdQ/Iz3bCos2IagUT7OfS6yrCqBYMit5i/KS6BlUzuQ7j5eDNlm15D0qR57JF7jz1tnljOqTeVcEJUeyGYq42ozCE2z+2jljn+Gl0rJPr8EJ6rjCYEvs8L2agxAZsMDoyqwrldJ7Pgo+HiWBMBUY4iu1GY97gZbbtKpMNN2Jy73/Tn2j0nOgxZ8PAxVj9WvzB80QQp1TcCv++GmBBjy9AKjBVyeJM2l3aNAFJl9WVyF2uDzxQqxxGKNfftI1zDLqckm+WXi3ga4= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f495efe-3b98-458d-019a-08daa3058db2 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2022 17:02:27.6732 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2P250MB0175 Subject: [FFmpeg-devel] [PATCH 1/7] avcodec/sunrast: Use ptrdiff_t for stride X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: ViNt4SQaDXju Fixes segfaults with negative linesizes; in particular, this affected the sunraster-(1|8|24)bit-(raw|rle) and sunraster-8bit_gray-raw FATE tests. Signed-off-by: Andreas Rheinhardt --- libavcodec/sunrast.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c index 77feef06e1..45b29e4d72 100644 --- a/libavcodec/sunrast.c +++ b/libavcodec/sunrast.c @@ -31,7 +31,8 @@ static int sunrast_decode_frame(AVCodecContext *avctx, AVFrame *p, { const uint8_t *buf = avpkt->data; const uint8_t *buf_end = avpkt->data + avpkt->size; - unsigned int w, h, depth, type, maptype, maplength, stride, x, y, len, alen; + unsigned int w, h, depth, type, maptype, maplength, x, y, len, alen; + ptrdiff_t stride; uint8_t *ptr, *ptr2 = NULL; const uint8_t *bufstart = buf; int ret; @@ -141,7 +142,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, AVFrame *p, if (type == RT_BYTE_ENCODED) { int value, run; - uint8_t *end = ptr + h * stride; + uint8_t *end = ptr + (ptrdiff_t)h * stride; x = 0; while (ptr != end && buf < buf_end) {