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

Subject: edid-decode: safely terminate edid vector with 0
Author:  Hans Verkuil <hverkuil-ci...@xs4all.nl>
Date:    Fri Nov 3 11:08:54 2023 +0100

We are using string functions for the EDID format parsing that
depend on 0-terminated sequences, so to be safe add a '\0'
after reading the EDID file.

Drop it again when it is processed as a binary file.

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

 edid-decode.cpp | 5 +++++
 1 file changed, 5 insertions(+)

---

diff --git a/edid-decode.cpp b/edid-decode.cpp
index dfeb2b964b76..515a3b5d5eff 100644
--- a/edid-decode.cpp
+++ b/edid-decode.cpp
@@ -1001,6 +1001,8 @@ static bool extract_edid(int fd, FILE *error)
                state.edid_size = 0;
                return false;
        }
+       // Ensure it is safely terminated by a 0 char
+       edid_data.push_back('\0');
 
        const char *data = &edid_data[0];
        const char *start;
@@ -1045,6 +1047,9 @@ static bool extract_edid(int fd, FILE *error)
        if (i == 32)
                return extract_edid_hex(data);
 
+       // Drop the extra '\0' byte since we now assume binary data
+       edid_data.pop_back();
+
        /* Assume binary */
        if (edid_data.size() > sizeof(edid)) {
                fprintf(error, "Binary EDID length %zu is greater than %zu.\n",

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

Reply via email to