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 6EBC74D11D for ; Mon, 10 Nov 2025 14:10:10 +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=1762783804; 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=Zt+mZDvoP6lJTl4in2Ccv83TKkxGGyYqDQyxs8N04e6P0j6VO3BP1JlacFpfshMRPzOYX Z6hKxj3rUZ2wc+wgBOZkpcjr5hwFvyld7YUmg/0IdmofewA+gHgQaEqWsAr8rXPrIJJIqkq 1BpnJM9o4Au1ppjJeluyJ2ATkwYiNYe20CPTZKjM6QS0dOnYIYw0J+iZeFkocnBy1BNW8bI AQykeYkG6csElCoCus4ZNPK0mh/uMOLSj3YCdFO/cV6rTOh7p54PTJGSEwddb9usU1tkoJc 7YRNNPFIPH6gzXeSlidyrxIpzjDsBdg9t7ah5WTNHTXMJiiLwd7ciJKcY7Ow== Received: from [172.19.0.2] (unknown [172.19.0.2]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 0B29368FB7A; Mon, 10 Nov 2025 16:10:04 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1762783788; b=DaqFAb+Dz7QjrXjb3oitFuAT2vvMvccTpKAFqHwCVMw5uRO99yQf07VJF7YC1OIBgwFZW cpSH1Sb+NnncswDp3IA8jve+mO/ZjQj9ewebK0C9DoPyY4TVK9j5PJ0oGrPt6BQXmKNliXr 5WjDPORtgojESs72QOp1ijg68piHWXddiN+nu8i7UaI8KlM9rMrItYDov8VxtbRDgO/jDiH 8r/4NZLCc1WTHCWEScnRxcDd5ztEyTiFhlFumi7Vee07zju3p7Dl9ZkVh5qVXBAGL+tWAPh Wk1vCRNQiQXNwu8F6zf1CTNbRGPuuuQQpdip8jlCqw+95s/juo/f4BvuXuRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1762783788; 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=nBkcO85m93pWjU9pe5MTcnLw/i5np6QeGD6k1U3Di0UldPEB3uBvRqpvjdsjtKp2f1WZY bLAbGa8wbBlwirdzNmeCu/dASVQlGtsXXBIRR0MaNcIerdARSd0m5W4kOVw/j650YaO/sBB 0yWipqQvHsjKBJf/tIDT2Bpte7LS7pygBoK9SaZeAqrH/51jxC+jXhj6ILhY3A3F3hIQw0b SdeDREU3wgoWVwqfzuOheI6DpvmCtQOWSdL39eQA8I3yWtZHRtlduwfEACDuwhJlVUvyLZo vtL2GeaW8N5iKMhrKS8kpemi22kB7Ier4Tmp/n1IeedC/tbVeqTk4J3/sr6Q== 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 BE7BD68F8EB for ; Wed, 5 Nov 2025 13:30:56 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mathias.im; s=dkim; t=1762341997; 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=otrrdTd2Gwml5bMBUaQHYqaRH+0RzsavSoFBuFwGez0i5ydwDw5BKHNVoZ56Mhr2xSPUW2 hrymvBa59mX+mZHW8D4PGF+gJUQ5jtSSwxOl8ZQqC8EmJM2oEJglZjLAWTp8FnSjfzhA9h dA8YmzBLPNDqYCTTMjFgedlYb6IGmtI= To: ffmpeg-devel@ffmpeg.org Date: Wed, 5 Nov 2025 12:29:53 +0100 Message-ID: <20251105112952.1474387-2-mail@mathias.im> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 X-MailFrom: SRS0=NbUO=5N=mathias.im=mail@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation 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 Message-ID-Hash: 7K2BOP6UTOJXBTYE5OVWPGQMCKLFA5TG X-Message-ID-Hash: 7K2BOP6UTOJXBTYE5OVWPGQMCKLFA5TG X-Mailman-Approved-At: Mon, 10 Nov 2025 14:09:41 +0000 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