From patchwork Thu Mar 14 23:21:17 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: 12309 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 7D072449640 for ; Fri, 15 Mar 2019 01:26:51 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 549B968A927; Fri, 15 Mar 2019 01:26:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 71D4D68A926 for ; Fri, 15 Mar 2019 01:26:44 +0200 (EET) Received: by mail-io1-f66.google.com with SMTP id c4so6695377ioh.9 for ; Thu, 14 Mar 2019 16:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=fkizSo4d1enGT0PpL0KlN42O/dyG/hNQQ/C5qPmM4d0=; b=RNpCL30ILf1WZqnq8cnHH3/eKqYCKVgTOO92FJLtAzC35H7f43f+NC68PBvdy77lhG b8zd11fUbhJaVWLJbjFq1pG4DaxObyVDsDPEWfLXcQdaZJvdnUht3+1/M5sbgPnyPKgw QojZqMpFD+Wmi4jXUugnw1Bs6qlQra1v4yzQGdIvavpi2DS7OgC7xdbDXvvvNhHmcaJ2 EH19lO03RIIzGH7Fau8m1S6U43ft7Py7bDNTuEhV/yy//s1iY5hRTr7aFjZHi8p9SMfM O7/yhPfJ+G0MtyM2AxGvc22WrICFRIfdI4BjD6PGZEOXqJzWGEz74Xoh8CiZ2ekuX9MP qfpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=fkizSo4d1enGT0PpL0KlN42O/dyG/hNQQ/C5qPmM4d0=; b=jc4ZJ3WjJpfdpRDF+RAxCJ1Q6q4fe6DcvjsBx3OyYKJGNHM1yfoCdAsuFHS8nhx570 Oa8LCnqumGBJAVHIJ4vAa8DjJRbKqe8IvnuTrkuS2ja5WUxz+xeNrhD6fulzGnnG1lG7 +ULjXGQ9mlhhdSMhMKLpG7nvY6Iggw4ti2mZksoHeMrjT3C3zxmpuaYe+uTqHpSzIYDP JI9AfFf7TfBmF8G8RN/IlEUYjE61bt2842GZo0X/rF3jL0HsS5S/qZGea7HxQ4MSy4Z7 vY/b+eNji6BTm1VK/zw1P451Z89LUNh2thkfytBYNjBKkUcQ4KsVI58fCxte6bTrQsbY TSiQ== X-Gm-Message-State: APjAAAUbSU0ceby6BXDNGlNebCVT9zTRu0/9cYwsMqqEInl44oARkUWI fImD8AamFS62JTFlXk39PaZHbmFJHWUJ2ODz4Vtdrg== X-Google-Smtp-Source: APXvYqwBdOMc9SBIIvkdOPFiUljwBtl3OEXTiDNd8j3IQflSXKw/DO//TFApXbRtmWEkwK18fXkAlx2tDdknEGlTxk8= X-Received: by 2002:a5d:9455:: with SMTP id x21mr403942ior.250.1552605678080; Thu, 14 Mar 2019 16:21:18 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:fca:0:0:0:0:0 with HTTP; Thu, 14 Mar 2019 16:21:17 -0700 (PDT) In-Reply-To: References: From: Carl Eugen Hoyos Date: Fri, 15 Mar 2019 00:21:17 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH]lavc/qtrle: Do not use aligned writes for odd addresses. 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" 2019-03-15 0:13 GMT+01:00, Hendrik Leppkes : > On Fri, Mar 15, 2019 at 12:05 AM Carl Eugen Hoyos > wrote: >> >> Hi! >> >> Attached patch fixes the qtrle crash on sparc for me. >> > > It should be fine in cases where the pointer is being incremented by > an aligned amount, ie. writing 32 and incrementing by 4, or 64 and 8, > etc. Of course, thank you for the review! New patch attached. Carl Eugen From a94d32d63cff248d2eb633b162e9e4d4f7234ee5 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 15 Mar 2019 00:02:48 +0100 Subject: [PATCH] lavc/qtrle: Do not used aligned writes for odd addresses. pixel_ptr can be 3. Fixes crashes on systems that do not allow unaligned access. --- libavcodec/qtrle.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index a744d7b..1351532 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -325,7 +325,7 @@ static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change CHECK_PIXEL_PTR(rle_code * 3); while (rle_code--) { - AV_WN16A(rgb + pixel_ptr, rg); + AV_WN16(rgb + pixel_ptr, rg); rgb[pixel_ptr + 2] = b; pixel_ptr += 3; } @@ -335,13 +335,13 @@ static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change rle_code_half = rle_code / 2; while (rle_code_half--) { /* copy 2 raw rgb value at the same time */ - AV_WN32A(rgb + pixel_ptr, bytestream2_get_ne32(&s->g)); /* rgbr */ - AV_WN16A(rgb + pixel_ptr + 4, bytestream2_get_ne16(&s->g)); /* rgbr */ + AV_WN32(rgb + pixel_ptr, bytestream2_get_ne32(&s->g)); /* rgbr */ + AV_WN16(rgb + pixel_ptr + 4, bytestream2_get_ne16(&s->g)); /* rgbr */ pixel_ptr += 6; } if (rle_code % 2 != 0){ /* not even raw value */ - AV_WN16A(rgb + pixel_ptr, bytestream2_get_ne16(&s->g)); + AV_WN16(rgb + pixel_ptr, bytestream2_get_ne16(&s->g)); rgb[pixel_ptr + 2] = bytestream2_get_byte(&s->g); pixel_ptr += 3; } -- 1.7.10.4