linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: joevt <joevt@shaw.ca>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org
Subject: [PATCH 04/28] edid-decode: check cta_hdr10plus length
Date: Fri, 24 Sep 2021 16:31:25 -0700	[thread overview]
Message-ID: <20210924233149.10028-5-joevt@shaw.ca> (raw)
In-Reply-To: <20210924233149.10028-1-joevt@shaw.ca>

- if the length is 0 then it cannot get Application Version. Output a fail message.
- cta_hdr10plus may output hex after "Application Version: %u". If the hex is longer than 16 characters, then more lines of hex will be output and they won't align with the first line.
Instead, always start the hex on a new line.

Signed-off-by: Joe van Tunen <joevt@shaw.ca>
---
 parse-cta-block.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp
index cee51d7..703f8ca 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -1133,11 +1133,12 @@ static void cta_microsoft(const unsigned char *x, unsigned length)
 
 static void cta_hdr10plus(const unsigned char *x, unsigned length)
 {
-	printf("    Application Version: %u", x[0]);
-	if (length > 1)
-		hex_block("  ", x + 1, length - 1);
-	else
-		printf("\n");
+	if (length == 0) {
+		fail("Empty Data Block with length %u.\n", length);
+		return;
+	}
+	printf("    Application Version: %u\n", x[0]);
+	hex_block("    ", x + 1, length - 1);
 }
 
 static void cta_dolby_video(const unsigned char *x, unsigned length)
-- 
2.24.3 (Apple Git-128)


  parent reply	other threads:[~2021-09-24 23:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-24 23:31 [PATCH 00/28] bug fixes, additions, changes joevt
2021-09-24 23:31 ` [PATCH 01/28] edid-decode: remove unnecessary length check joevt
2021-09-24 23:31 ` [PATCH 02/28] edid-decode: fix standard timing vertical pixels joevt
2021-09-24 23:31 ` [PATCH 03/28] edid-decode: exclude oui from _block functions joevt
2021-09-24 23:31 ` joevt [this message]
2021-09-24 23:31 ` [PATCH 05/28] edid-decode: Capitalize fail sentence joevt
2021-09-24 23:31 ` [PATCH 06/28] edid-decode: Replace return with break in switch joevt
2021-09-24 23:31 ` [PATCH 07/28] edid-decode: extended tag length check joevt
2021-09-24 23:31 ` [PATCH 08/28] edid-decode: Output block type before fail joevt
2021-09-24 23:31 ` [PATCH 09/28] edid-decode: update Microsoft expected length joevt
2021-09-24 23:31 ` [PATCH 10/28] edid-decode: Capitalize fail sentence joevt
2021-09-24 23:31 ` [PATCH 11/28] edid-decode: make all OUI handlers the same joevt
2021-09-24 23:31 ` [PATCH 12/28] edid-decode: move OUI parsing to separate function joevt
2021-09-24 23:31 ` [PATCH 13/28] edid-decode: move unknown block warning joevt
2021-09-24 23:31 ` [PATCH 14/28] edid-decode: remove cta_ext_block joevt
2021-09-24 23:31 ` [PATCH 15/28] edid-decode: change unknown CTA block names joevt
2021-09-24 23:31 ` [PATCH 16/28] edid-decode: move audio fail/warn messages joevt
2021-09-24 23:31 ` [PATCH 17/28] edid-decode: replace first_block with block_number joevt
2021-09-24 23:31 ` [PATCH 18/28] edid-decode: move parse_displayid_block inner loop joevt
2021-09-24 23:31 ` [PATCH 19/28] edid-decode: remove offset from displayid_block joevt
2021-09-25  9:05 ` [PATCH 00/28] bug fixes, additions, changes Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210924233149.10028-5-joevt@shaw.ca \
    --to=joevt@shaw.ca \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).