From patchwork Sat Jul 25 05:14:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 21255 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 CA39644BBF7 for ; Sat, 25 Jul 2020 08:15:23 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A28BE68B64A; Sat, 25 Jul 2020 08:15:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1E61268B60E for ; Sat, 25 Jul 2020 08:15:16 +0300 (EEST) Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4BDDm368j9zKmXK for ; Sat, 25 Jul 2020 07:15:15 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id 6-OTDxp5RY-2 for ; Sat, 25 Jul 2020 07:15:11 +0200 (CEST) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Sat, 25 Jul 2020 10:44:43 +0530 Message-Id: <20200725051444.183-1-ffmpeg@gyani.pro> MIME-Version: 1.0 X-MBO-SPAM-Probability: 5 X-Rspamd-Score: 0.79 / 15.00 / 15.00 X-Rspamd-Queue-Id: BB309180D X-Rspamd-UID: 914af4 Subject: [FFmpeg-devel] [PATCH] avformat/riffenc: correct calculation for extradata size 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" In 1ec2b3de5a, the extradata size was affected when the raster was signaled as flipped due to user-set option rather than via extradata. This resulted in a wrong header size being written. Fixed. --- libavformat/riffenc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index d0ee98bfcc..04a21fcffa 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -209,10 +209,10 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, int for_asf, int ignore_extradata, int rgb_frame_is_flipped) { - int keep_height = (par->extradata_size >= 9 && - !memcmp(par->extradata + par->extradata_size - 9, "BottomUp", 9)) || - rgb_frame_is_flipped; - int extradata_size = par->extradata_size - 9*keep_height; + int flipped_extradata = (par->extradata_size >= 9 && + !memcmp(par->extradata + par->extradata_size - 9, "BottomUp", 9)); + int keep_height = flipped_extradata || rgb_frame_is_flipped; + int extradata_size = par->extradata_size - 9*flipped_extradata; enum AVPixelFormat pix_fmt = par->format; int pal_avi;