From patchwork Sun Apr 29 19:19:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 8693 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp2812664jad; Sun, 29 Apr 2018 12:20:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo0RaTlfxCfgJGL0AmR3doVqO3tbGBN8izWzUifkk5ztuvJV00/xi5N4aH0LjHU2L6fceSF X-Received: by 2002:adf:93e5:: with SMTP id 92-v6mr1735500wrp.230.1525029656662; Sun, 29 Apr 2018 12:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525029656; cv=none; d=google.com; s=arc-20160816; b=cenVOeXjpRswYpZdF8qaySOPT9TYGgakuVE12TFoWge8Zh8gQ2gBU4eLI5wAkH2tHl oUBy36MHZ5+ne0b1ZTOHkBt/tSqTg5+LRK1a3ntYOBHwjsdtxMhH5qMSvdTdQA6/zhsr 0GmPtRhsl4iXuYOIXxVjLG8M4ZPJqEW6dQolURCPojMYY3ldxcJioyI2Zxy7h+FiAIIQ iRd55DRCsdJnGXg6xcCqFo+mEBcX3/Hf803elLomBdpK7RILsc3X7v2Cy6N6Y11WsAIs UfK3TSQdaSCya7dGduxZ3M8282mZSJDt7rfSEreUBUAk6iXXL9D2G/O0zi1nO8ABaenN Zl2w== 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=CzATtxPkYDYm0+LJUPJcL0CfsNqVuEs3dAPnuf1Eezw=; b=Msd2af4akRvhkZ26nC6Oe0sth2fiH9P2fusMB+JK8RkhxCKQErV5iG8BxEFhR5nMeN rwMKTLeHrb2W975D4juKopSTu4AeTyHbI6kkkHHGvhLudRSVgjfOsMK2RES8LOSpeSt2 kyEDRC6CRXTsGx6MPmXMJWpuuePe2lJcRcL4sz78KEg1rDpAARDOGwHZIHND2YnEGIgL 3xehJXZJ45Bb9/z2ZP1ZjPoptuwmYS/CEMONPetq0p5SHr7KEqIj9ll/m5UsWypbale/ xMuvJUt1D7e7DL1dQ8CJtKfaA7dPvxzYLQTYPTreuqT1mDerVmRn2oOr3KGaktih3iW7 gVmw== 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 x73si4496577wmd.51.2018.04.29.12.20.56; Sun, 29 Apr 2018 12:20:56 -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; 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 BE4A268A68E; Sun, 29 Apr 2018 22:20:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe01-3.mx.upcmail.net (vie01a-dmta-pe01-3.mx.upcmail.net [62.179.121.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 709D368A663 for ; Sun, 29 Apr 2018 22:20:06 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fCrsE-0005mK-0n for ffmpeg-devel@ffmpeg.org; Sun, 29 Apr 2018 21:20:38 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id gKLW1x01M0S5wYM01KLX6e; Sun, 29 Apr 2018 21:20:31 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 29 Apr 2018 21:19:17 +0200 Message-Id: <20180429191918.2915-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180429191918.2915-1-michael@niedermayer.cc> References: <20180429191918.2915-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/mpeg4videodec: Do not corrupt bits_per_raw_sample 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" Signed-off-by: Michael Niedermayer --- libavcodec/mpeg4videodec.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 9318d7bd4e..33cdc7a1b2 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2999,6 +2999,7 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) { MpegEncContext *s = &ctx->m; int width, height; + int bits_per_raw_sample; skip_bits1(gb); /* random_accessible_vol */ skip_bits(gb, 8); /* video_object_type_indication */ @@ -3014,8 +3015,8 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) return AVERROR_INVALIDDATA; } - s->avctx->bits_per_raw_sample = get_bits(gb, 4); /* bit_depth */ - if (s->avctx->bits_per_raw_sample == 10) { + bits_per_raw_sample = get_bits(gb, 4); /* bit_depth */ + if (bits_per_raw_sample == 10) { if (ctx->rgb) { s->avctx->pix_fmt = AV_PIX_FMT_GBRP10; } @@ -3024,9 +3025,10 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) } } else { - avpriv_request_sample(s->avctx, "MPEG-4 Studio profile bit-depth %u", s->avctx->bits_per_raw_sample); + avpriv_request_sample(s->avctx, "MPEG-4 Studio profile bit-depth %u", bits_per_raw_sample); return AVERROR_PATCHWELCOME; } + s->avctx->bits_per_raw_sample = bits_per_raw_sample; } if (ctx->shape == RECT_SHAPE) { check_marker(s->avctx, gb, "before video_object_layer_width");