This is an automatic generated email to let you know that the following patch 
were queued:

Subject: edid-decode: CTA-861: check for invalid offset, always show byte 3
Author:  Hans Verkuil <hverkuil-ci...@xs4all.nl>
Date:    Thu Oct 26 11:49:09 2023 +0200

Offset (byte 2) values of 1-3 are always wrong, so fail on that.

Always parse byte 3 of the CTA Extension Block, even if offset == 0.

Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>

 parse-cta-block.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

---

diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp
index 1a133fcb75a1..ac337141526c 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -2816,15 +2816,14 @@ void edid_state::parse_cta_block(const unsigned char *x)
                fail("The HDMI Specification requires CTA Extension revision 
3.\n");
        if (version > 3)
                warn("Unknown CTA-861 Extension revision %u.\n", version);
+       if (offset > 0 && offset < 4)
+               fail("Invalid CTA-861 Extension offset value (byte 2).\n");
 
        if (version >= 1) do {
                if (version == 1 && x[3] != 0)
                        fail("Non-zero byte 3.\n");
 
-               if (offset < 4)
-                       break;
-
-               if (version < 3 && ((offset - 4) / 8)) {
+               if (version < 3 && offset >= 4 && ((offset - 4) / 8)) {
                        printf("  8-byte timing descriptors: %u\n", (offset - 
4) / 8);
                        fail("8-byte descriptors were never used.\n");
                }
@@ -2873,6 +2872,10 @@ void edid_state::parse_cta_block(const unsigned char *x)
                                        fail("The HDMI Specification requires 
that the first Extension Block (that is not a Block Map) is an CTA-861 
Extension Block.\n");
                        }
                }
+
+               if (offset < 4)
+                       break;
+
                if (version >= 3) {
                        unsigned i;
 

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to