From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 157274BFAD for ; Wed, 5 Nov 2025 11:35:53 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'pELeCdWAATtV0YW6H+qfPbn/bVnHb3iB3ZisOSqAC3w=', expected b'SCbAAXUkcwIHo3knE19vNwNcDR8B4kk3rjhZW686xqo=')) header.d=mathias.im header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1762342543; h=to : date : message-id : mime-version : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=MNKGf/GevFtqBnzGTFgwOBjx2O9mdqrymHoAhmMdRrY=; b=ztBmO6/Q8oaAy8PzQ4OsRiP7trhykxjQPZsjjoX5IdZ7lnG/e0qJed3E767h40T1XGbtG BWUdLF+IcSeOwSR3JbIYQwPOx2NvC22e5n9oXf6O4bxQQWCR6EYqTgemjfg+Dbz3hVhDQBQ LjWj7/2t5c4WC5M0ExAFmttv4C0KkB3JxjCBqUumCRe/Xkjey0dFkcL92t45WTU5qD3zSJA 4AS1kWFb9d2ymukMmKGCxPQekpfv5VXMSDRxZyALZ8Hao+uRgl11ZIxaRlVtgihz+diM4pn +Jk1mnY1WbZDMvJCZURxvw5kzcpIhMj5obsihjRw8R3A1tfQerX/lRzNfpCA== Received: from [172.19.0.2] (unknown [172.19.0.2]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id A431068FB88; Wed, 5 Nov 2025 13:35:43 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1762342526; b=rHJiCeH7HFl/6aoshDiLbI6RYKbFefn5F5OeR6uH+qIhPHwxTRtrWG36XyU4yg5ediAPi ZjZdDwesH53K0CAb7DtXnjx0lnAFPIW+CoKHlwO/SbCXGtg7tj9iUvgSFjuzCFNYabIsUHF QCBDHCD47bnrJwiZGBdWTCEDjXrZCP7NXGIueqqIx4hbl4dhUH+VKMQYFTrh5Hzg4EVLzQz g0jZGJSTY+a+XiVwOa19DeaeQr9zDxX+xHN+al1Qmj2UIxuTF92shAcXtV9tpORjHbn4kQY /Z/YiiFVaC0Dq0jPNqxcpKiM1XepsoaVD46PHHTlgnFVqYeZtTkMlN8iW4hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1762342526; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=pELeCdWAATtV0YW6H+qfPbn/bVnHb3iB3ZisOSqAC3w=; b=uagN04zUdYBBvsKl0mBiZgksjzzvoi95N89aVD34OJcmCvozXIzg+gW1lotahEr7s/nJy Id6K5LTnyguUMOVYUsH7Z64IzfBMx0QN6d/PLAgaFvc2H4C9c5xIY/EbJjtcKAPsQZz+JB0 jFaFfWs3I0wmbmmPAs2i7+TtBfrRsOAlEa3A0mD2rMMRyvMHqTF2tCfmw9eCz1CulKvtX/A Ca1Rt2u7vlK/njI2JCaFfIxSvzpro2qw1a8Uv0QWVDhbQjejWtzSxytMrbez/ZIZN58nBJf j52Vl5QrTbHxWG/ANUioS5a/x6Yhqa0Ky6rFNPkPDDRI/SWxCrPUdfG9vrKg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=mathias.im; arc=none; dmarc=pass header.from=mathias.im policy.dmarc=reject Authentication-Results: ffmpeg.org; dkim=pass header.d=mathias.im; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=mathias.im policy.dmarc=reject Received: from fs.host.decodem.io (fs.host.decodem.io [62.141.42.84]) by ffbox0-bg.ffmpeg.org (Postfix) with UTF8SMTPS id C8EF668F8EB for ; Wed, 5 Nov 2025 13:35:15 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mathias.im; s=dkim; t=1762342257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=SCbAAXUkcwIHo3knE19vNwNcDR8B4kk3rjhZW686xqo=; b=ywcu6vp1/4iPBDPskycvcDOX7HklXtfZqcAqJOvzrqtX3lG2W6feL5vnzf2pz+7D3cpzMY nhXyWGIkLcwwa1tnKL+561S5BK/doxwj2nV36rPoWFlko8SXbWbM016dT+GlO2t7SK1Qcj JswjFF0yQT53zXQ5m+HmgKDO+5Dot2c= To: ffmpeg-devel@ffmpeg.org Date: Wed, 5 Nov 2025 12:35:09 +0100 Message-ID: <20251105113508.1476447-2-mail@mathias.im> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Message-ID-Hash: EOBA3FDS5UE753QKHOWIIDG2GRAJQOYC X-Message-ID-Hash: EOBA3FDS5UE753QKHOWIIDG2GRAJQOYC X-MailFrom: SRS0=NbUO=5N=mathias.im=mail@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avcodec/tiff: Check order only for tags that we process List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Mathias Koehler via ffmpeg-devel Cc: Mathias Koehler Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: The initial out of order check was introduced with commit ad29f9e47cb avcodec/tiff: Restrict tag order based on specification This changes the check to only check against tags the we process since tags that we don't process shouldn't cause any bugs. Example of CinemaDNG files with incorrect ordered tags that causes problems: https://www.dji.com/de/inspire-3/samples --- libavcodec/tiff.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index bb8120bc1b..7458167fb3 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1254,7 +1254,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) { AVFrameSideData *sd; GetByteContext gb_temp; - unsigned tag, type, count, off, value = 0, value2 = 1; // value2 is a denominator so init. to 1 + unsigned tag, prev_last_tag, type, count, off, value = 0, value2 = 1; // value2 is a denominator so init. to 1 int i, start; int pos; int ret; @@ -1268,8 +1268,10 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) return AVERROR_INVALIDDATA; // We ignore TIFF_STRIP_SIZE as it is sometimes in the logic but wrong order around TIFF_STRIP_OFFS - if (tag != TIFF_STRIP_SIZE) + if (tag != TIFF_STRIP_SIZE) { + prev_last_tag = s->last_tag; s->last_tag = tag; + } off = bytestream2_tell(&s->gb); if (count == 1) { @@ -1874,6 +1876,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) tiff_set_type(s, TIFF_TYPE_CINEMADNG); break; default: + // We don't care about out of order tags that we don't process + s->last_tag = prev_last_tag; if (s->avctx->err_recognition & AV_EF_EXPLODE) { av_log(s->avctx, AV_LOG_ERROR, "Unknown or unsupported tag %d/0x%0X\n", -- 2.51.0 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org