From patchwork Sat Jun 9 20:57:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9332 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:11c:0:0:0:0:0 with SMTP id c28-v6csp2391630jad; Sat, 9 Jun 2018 13:57:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLy8t60MPEHXPgTL/VRbmcLPDrrH85Hi/Htc48JmAeSmcAPSItqDUrkXPxxk+R8QL5O4lff X-Received: by 2002:a1c:d287:: with SMTP id j129-v6mr4270995wmg.106.1528577866847; Sat, 09 Jun 2018 13:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528577866; cv=none; d=google.com; s=arc-20160816; b=lJMYi4p3tzyL5O0Ag7s7dIl43IjUoX2GIIK1RDQBgGfm3Ii8iXmfbLVysrl666VVMm kFvns7DfWV7p94LxU3g4svkJSPoOtx4tR1pRabJfubxmLg3yWY7LvZ7YQVvN9C1u6lZ+ +93IhLbQ+D3OP77xM9zeLps7MY2k+hQF2tybtDNk6yQG6lLKeC43bsV/1BYclZCYEqic Kr3JugSyLOApwEAesyNht5vkil2QBG8d/oQgs8EQSv52Gf4WFTRUHl/ShjyERnIkSM+j IUmpS4IbHAZMgl4N4AJYAFdsnZenpVpNyTQa8UXrdvfAHmg64NueCZvlgSyP3xkHI7RJ YAfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to:arc-authentication-results; bh=gGYixyPq6XsaR92I+CG+5aIDqQx4t/E389ZbNGLfU2o=; b=x28Ab0JC5bk63DqNg/t6PKxxHlsQJtIAHcnT8AFR3Vl3rdszodlu18GomkeDSr44sB NG7VtPI0eLDDCKh/L6kLzTVxkA7v1A3KowTLM4ZwQTykLiHDY+FnaG4saA5rgnpYCkIC orr32C4tUqqnNbWMjQ/GDmU3rgP3cXeBq+H7pu64ycP7vznjVccfDGEHc0IbjWYw5McJ 9PQ9y48dQmZ/pAT8LmAAZYwakZM1h+Lwr/lLvKe5HWXUVCTtPlVn5YKByLH8+o3X4rCs 0Tsg29sO+0P60sc+8oD59hlSatpf7LNrEqz5ioaXkR9n3I2OgZQD3M7Uwf4LpeEQvkjR v9DA== 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 w9-v6si13346566wrb.286.2018.06.09.13.57.46; Sat, 09 Jun 2018 13:57:46 -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 11F4E68A9F1; Sat, 9 Jun 2018 23:56:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe04-3.mx.upcmail.net (vie01a-dmta-pe04-3.mx.upcmail.net [62.179.121.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B81E668A9E2 for ; Sat, 9 Jun 2018 23:56:49 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fRkvZ-0008SS-RI for ffmpeg-devel@ffmpeg.org; Sat, 09 Jun 2018 22:57:37 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id wkxT1x00X0S5wYM01kxU7F; Sat, 09 Jun 2018 22:57:28 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 9 Jun 2018 22:57:05 +0200 Message-Id: <20180609205705.2820-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/mpeg4videodec: Clear bits_per_raw_sample if it has originated from a previous instance 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" Fixes: assertion failure Fixes: ffmpeg_crash_5.avi Found-by: Thuan Pham , Marcel Böhme, Andrew Santosa and Alexandru Razvan Caciulescu with AFLSmart Signed-off-by: Michael Niedermayer --- libavcodec/mpeg4videodec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 51b58fac02..d0ebaac6e8 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -3109,6 +3109,12 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb) /* search next start code */ align_get_bits(gb); + // If we have not switched to studio profile than we also did not switch bps + // that means something else (like a previous instance) outside set bps which + // would be inconsistant with the currect state, thus reset it + if (!s->studio_profile && s->avctx->bits_per_raw_sample != 8) + s->avctx->bits_per_raw_sample = 0; + if (s->codec_tag == AV_RL32("WV1F") && show_bits(gb, 24) == 0x575630) { skip_bits(gb, 24); if (get_bits(gb, 8) == 0xF0)