aboutsummaryrefslogtreecommitdiffstats
path: root/parse-displayid-block.cpp
diff options
context:
space:
mode:
authorjoevt <joevt@shaw.ca>2021-09-28 03:38:34 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-09-30 11:03:12 +0200
commit94edff4a27fe3773aabff37213595445ae0a4cdb (patch)
tree6d6d4412ee3b8267505af0a40864c42698293e65 /parse-displayid-block.cpp
parent39221e64e140fc64982159257568f317cde02283 (diff)
edid-decode: output correct unknown block length
The correct length of a DisplayID block is len. It is the number of bytes in the payload bytes (doesn't include the tag or length or revision). It may include the OUI but we don't output the OUI in hex_block, and an unknown block can't have an OUI unless there's a new DisplayID spec with a new type of block that we don't know about. The length parameter passed to displayid_block is the number of bytes that remain in a DisplayID extension block (maybe it needs to be renamed?). We pass it to displayid_block so it can handle length related errors. displayid_block handles all interpretation of the data block. The only byte we know that can be interpreted on entry is the tag byte because it is the first byte and length is at least one (according to the for loop in parse_displayid_block). The payload length byte occurs after the tag byte - it might exist beyond the limit of length. If that's the case, we can at least report the tag block type with the error, but we choose not to. Instead, we output the rest of the bytes (including the tag) as hex because it probably isn't a real block. Signed-off-by: Joe van Tunen <joevt@shaw.ca> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'parse-displayid-block.cpp')
-rw-r--r--parse-displayid-block.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse-displayid-block.cpp b/parse-displayid-block.cpp
index b318766..c8cea53 100644
--- a/parse-displayid-block.cpp
+++ b/parse-displayid-block.cpp
@@ -1711,7 +1711,7 @@ unsigned edid_state::displayid_block(const unsigned version, const unsigned char
// 0x80 RESERVED
case 0x81: data_block = "CTA-861 DisplayID Data Block"; break;
// 0x82 .. 0xff RESERVED
- default: data_block = "Unknown DisplayID Data Block (" + utohex(tag) + ", length " + std::to_string(length) + ")"; break;
+ default: data_block = "Unknown DisplayID Data Block (" + utohex(tag) + ", length " + std::to_string(len) + ")"; break;
}
if (length < 3) {

Privacy Policy