[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>
diff --git a/source/disassemble.cpp b/source/disassemble.cpp
index aa20fab..0add260 100644
--- a/source/disassemble.cpp
+++ b/source/disassemble.cpp
@@ -605,7 +605,7 @@
if (line[i] == '\x1b') {
do {
++i;
- } while (line[i] != 'm');
+ } while (i < line.size() && line[i] != 'm');
continue;
}