From patchwork Wed Sep 28 16:35:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38443 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp357789pzh; Wed, 28 Sep 2022 09:36:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65VZdMwR0kEV96lIM6iwnyME2rGve+x5Rh5HK7hv5+wbx6xLcISQHTqsm3GLZRhyq6MSKe X-Received: by 2002:a17:907:2d09:b0:782:7120:7092 with SMTP id gs9-20020a1709072d0900b0078271207092mr27235925ejc.141.1664382963193; Wed, 28 Sep 2022 09:36:03 -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 g18-20020a170906869200b00780b0992eafsi4352358ejx.561.2022.09.28.09.36.02; Wed, 28 Sep 2022 09:36:03 -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=ZEzOdEiV; 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 89DE068BBBA; Wed, 28 Sep 2022 19:36:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2033.outbound.protection.outlook.com [40.92.89.33]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C995468BABE for ; Wed, 28 Sep 2022 19:35:54 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eCdtLbfOsExkarS6o2+St/fRebPvF5PbCPz5FY/e/GHlruwVraN00U4RRIqOB0N6uAXsJe3CWrLfYxN0ZN5FOOgvuUzm2UbSJwzejioMlOU73Jcc+nPj/rVK9mRcO3MMzSGTLq3g8CeLn7UQd8Ik3f9KwngJA6AMdhcfJNbdyT8VmZsjMmIFN4wuaCIxf/yYE4Y68U9gsE3CZf1AySUSF0BV9uLIOco/MRFf87y4kCOvv3CIWinA5x1stYDcRapRAA+6AukfdWDekzJoFSgHrMO5SNN5vl8HIG1jRMpRejX2YI/3RKJ226Fa5AEiYWoR62zlug1rTULA317ysEUBEw== 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=FUOyAkPQliWO7HwYNhan7Y5UBUYI29LJVnPj9U9q1yM=; b=Sh0Q06BM7p9VQnf/wP5z1Q+4mvVX2mgejOB4sxYl3q8bxH7i2EdX7nvSYWSKvpWKhwSjGv5vKX3x+MrB3BvRAXAANNECm3haVfRqhrRE7GKizbgLQeWpZBj2sBegiALEQR2IBUuvxm2wrS4gJynkvxL8rhNjaL5yHZPqfPQ0mLIKQpLaYY/upXacpKZfUpGATlM9WoyMSW9wrIOR/iI/XqBnXF3UFZUoIzMCCWKcEBA+KxMUxhIp5VN9hNI6sWUxRgVcwFQS9CndwTVaZvZv5aB4cXZW6FP6+cWAIWDRP4soaDiXAUIzltmRjOa56tUkrZiMdJeVL3F1ENYlgoKvmA== 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=FUOyAkPQliWO7HwYNhan7Y5UBUYI29LJVnPj9U9q1yM=; b=ZEzOdEiVJDR54wND7K6V/s97KtHw2AfoRPM2pe2dhPc2ydR9CMYjMppZ4tNXFm20L4lFKFuHS6sFzKkw8k/5b5CwcJBchKU2YRTUHamOXX3/7QHQaepLGcCvrr0PYW/dEBpsEq8nYGE/wLjukWQMWGh2p9211fGEpbqUrrAoWS7ZF3G7SenvTmUil/tbeAz6XWB0RQ59vtKsmRslghLzs2epnamLNV0NvKez19snq8A0xtl3sUohZ+vhYqPwJRAquPHY3mIiOaP00hVpy+loVhLZIaztAbNMsufqdPO/G19RYsJGCtHLa37ZcmYOxz1cHR6kKxxzfEqJy7oTYtL0BQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0006.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:359::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.15; Wed, 28 Sep 2022 16:35:52 +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; Wed, 28 Sep 2022 16:35:52 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Sep 2022 18:35:47 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [TetY/wYFZ1KWIV4CykDBS+DLpBVu+MVyO6Cczc8orZ4=] X-ClientProxiedBy: ZRAP278CA0009.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::19) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220928163550.916073-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0006:EE_ X-MS-Office365-Filtering-Correlation-Id: 714ecb5e-5b74-4b33-7515-08daa16f820b X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmpPcoZqFl/i/jhf7c/pX34TNjkWAAFWEIfDtldljUfAFlhdV2O9u8+OB90TMYsNyGI5JbA90LTzPisOC6Z+m0rH+iMqd4PTb63Ny7x0pXDR5mHlYOxRPaFxwQYu8f/XZ5fOaw+needN+NVPWFszd4SWdZG92VKyp5e+R2vyGjEN63YEKEIUkw5JkFqDRqbfOE5MvagUiKoMupuEsBK4yfjuytvrTETj4KrfK8STEMRJJjrso+ZTJoRdhoFdLFwpoaZVR55SQxb6bs2jRKkMTiJ9Vfu6V5NGcE4d3ML/dEuZfGeXCawwxbFQ+sA9a+cCIK+pOkOG4/821ormk3nBqjNpiB/Iv99Ga+zBbrA7F0kMKplWhnXd7W1ZkjIzFOUV3Es/N1uKDiFjp5ZBpiyreejjy4vM1Nkjs4Xf60G/PWlZUfjLYu9Jly3sBbi+t0KzyOCuXuFpT0Zs6DIwsNZEEYk/PsWm9mOSkk3wRGeOEBIhfX+zjnbWh7rV+oHcd7+pyT+E4Vcb2F8aVpaxyp/Iq3Yw/MflXkc4A4HSNbxFYLKY8HsPrEXTOcO+u0uzqK35zrIfgGZD/QkAq0ESXQc1EzlrZdoiawkj6dZ2bKdUiVlVJjQ21QodYkKD9I0iTHBnG0KYurIHP0vUCBTQhBSNNRLcwcrYYKi4HP+Oyn+ZMelYw0x67DAQJYtOvA4KjXmLgyYKb3BzX7gV8RCGs0q6VkzGaJfZi7RJJ+d7Y1nryANTTf+mCNiuuCg3p/6mRrNzIfw= X-Microsoft-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-4b33-7515-08daa16f820b X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2022 16:35:52.3765 (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: AS8P250MB0006 Subject: [FFmpeg-devel] [PATCH 2/5] avcodec/rl2: Don't presume stride to be > 0 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: 4W6On3/0OOos Signed-off-by: Andreas Rheinhardt --- Lots of fate tests fail if this assumption is not fulfilled. libavcodec/rl2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/rl2.c b/libavcodec/rl2.c index 2464ad59ac..467c4913a4 100644 --- a/libavcodec/rl2.c +++ b/libavcodec/rl2.c @@ -65,7 +65,7 @@ static void rl2_rle_decode(Rl2Context *s, const uint8_t *in, int size, int i; const uint8_t *back_frame = s->back_frame; const uint8_t *in_end = in + size; - const uint8_t *out_end = out + stride * s->avctx->height; + const uint8_t *out_end = out + stride * s->avctx->height - stride_adj; uint8_t *line_end; /** copy start of the background frame */ @@ -100,18 +100,20 @@ static void rl2_rle_decode(Rl2Context *s, const uint8_t *in, int size, *out++ = (val == 0x80) ? *back_frame : val; back_frame++; if (out == line_end) { + if (out == out_end) + return; out += stride_adj; line_end += stride; - if (len >= out_end - out) - return; } } } /** copy the rest from the background frame */ if (s->back_frame) { - while (out < out_end) { + while (1) { memcpy(out, back_frame, line_end - out); + if (line_end == out_end) + break; back_frame += line_end - out; out = line_end + stride_adj; line_end += stride;