From patchwork Sun Jan 28 01:29:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7429 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.156.27 with SMTP id q27csp2379809jak; Sat, 27 Jan 2018 17:29:35 -0800 (PST) X-Google-Smtp-Source: AH8x226cQFeP9qOtw5P4qWqhDecu+9QBHGbHULncd2kDaTyKxkDn+JviBMml6x7hxXKTByORGllB X-Received: by 10.28.71.77 with SMTP id u74mr13984135wma.150.1517102975750; Sat, 27 Jan 2018 17:29:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517102975; cv=none; d=google.com; s=arc-20160816; b=kwJGCIyKolqckNBHo1hAco6Jb8/7LV2nHvzDoiPRq+F/4fFAyqGzIrWUlfCScdnvs2 QUwy9lhSyg6y0MRl9YnM2N+1X0xWSkrN0oCr61YoSMS8fYk3El0PpNSfjPsmzdFOyVbY /REPfe/QWEhGfuGXrJBTTeR/7D/mfvXz5n8QQTNQFoAzi2pRdQVzr/NX4JT3v7rCYKc4 uZuXhEnESJoiUkI4EdI4H/m9wRpduw9uFZ9WIMXqVtXbbitMrwwRlXtWVyAo3S8woJAX 9RLCxk36VBQSSNFNJ8GtMym9OW+Gtz3s7md948DGtsNFBm0Fjstx1gYMaAVeLnyVrKvA hRow== 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=9ZbVReqDmcBF/Q2TcKDX9iKd7eh9VT8/yuQLdDsJkMA=; b=LcMBDYTHoLia6+fz22/LA5AlKazZpg4xAmMeJu5baN4zCK3tSCX2u0dTwNNrHnuZ49 vNkKDLVIuJ0VLDjvt7l/sB/ETzaxJnFjtll/x8o4jVmQuOQujGBlCoJhTdZdhJ5tg37H lBcph/d12OgWllPDVP0Zj9r7+FDtrrP4sqAVeNQliDDBxM3epVe64n2EJ5eWbsgKEyvb 0tW+JQZrGZW+/k+c1UgtGGUHFShBVRxhuU1Kf8NDwEumy/6gvXjXp499kEg8ID0iF4rb T7s72rRQSMJC5Nx8CSzxqKBtc3Om8s4GxcyDUrQVE9O8x8xWC88RNWFzrktQ4YadJrgG 4xVQ== 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 s6si5067235wma.63.2018.01.27.17.29.35; Sat, 27 Jan 2018 17:29:35 -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 A40206804C8; Sun, 28 Jan 2018 03:29:21 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-1.mx.upcmail.net (vie01a-qmta-pe02-1.mx.upcmail.net [62.179.121.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CB3896803CE for ; Sun, 28 Jan 2018 03:29:13 +0200 (EET) Received: from [172.31.218.38] (helo=vie01a-dmta-pe03-2.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1efbmX-0004Ac-FO for ffmpeg-devel@ffmpeg.org; Sun, 28 Jan 2018 02:29:17 +0100 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1efbmR-0005a8-VK for ffmpeg-devel@ffmpeg.org; Sun, 28 Jan 2018 02:29:11 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 3dV51x01A0S5wYM01dV6M8; Sun, 28 Jan 2018 02:29:06 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 28 Jan 2018 02:29:02 +0100 Message-Id: <20180128012902.22504-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180128012902.22504-1-michael@niedermayer.cc> References: <20180128012902.22504-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/mpeg4videodec: Avoid possibly aliasing violating casts 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" Found-by: kierank Signed-off-by: Michael Niedermayer --- libavcodec/mpeg4videodec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index ba332de531..756753e2fc 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1256,10 +1256,12 @@ not_coded: */ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) { - Mpeg4DecContext *ctx = (Mpeg4DecContext *)s; + Mpeg4DecContext *ctx = s->avctx->priv_data; int cbp, mb_type; const int xy = s->mb_x + s->mb_y * s->mb_stride; + av_assert2(s == (void*)ctx); + mb_type = s->current_picture.mb_type[xy]; cbp = s->cbp_table[xy]; @@ -1341,12 +1343,13 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) { - Mpeg4DecContext *ctx = (Mpeg4DecContext *)s; + Mpeg4DecContext *ctx = s->avctx->priv_data; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; int16_t *mot_val; static const int8_t quant_tab[4] = { -1, -2, 1, 2 }; const int xy = s->mb_x + s->mb_y * s->mb_stride; + av_assert2(s == (void*)ctx); av_assert2(s->h263_pred); if (s->pict_type == AV_PICTURE_TYPE_P ||