[NFC] Fix potential buffer overflow (#5715)

Fixing a clusterfuzz finding.
If the given binary has debug instruction which contained
a badly formatted ANSI escape sequence, the iteration could
go beyond the string length.

Signed-off-by: Nathan Gauër <brioche@google.com>
This commit is contained in:
Nathan Gauër 2024-06-25 12:08:28 +02:00 committed by GitHub
parent b9d8114695
commit 64d37e2811
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -605,7 +605,7 @@ uint32_t GetLineLengthWithoutColor(const std::string line) {
if (line[i] == '\x1b') {
do {
++i;
} while (line[i] != 'm');
} while (i < line.size() && line[i] != 'm');
continue;
}