浏览代码

tracetool: Forbid newline character in event format

Events aren't designed to be multi-lines. Multiple events
can be used instead. Prevent that format using multi-lines
by forbidding the newline character.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Mads Ynddal <mads@ynddal.dk>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20240606103943.79116-6-philmd@linaro.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Philippe Mathieu-Daudé 1 年之前
父节点
当前提交
4c2b6f3287
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      scripts/tracetool/__init__.py

+ 2 - 0
scripts/tracetool/__init__.py

@@ -301,6 +301,8 @@ def build(line_str, lineno, filename):
         if fmt.endswith(r'\n"'):
             raise ValueError("Event format must not end with a newline "
                              "character")
+        if '\\n' in fmt:
+            raise ValueError("Event format must not use new line character")
 
         if len(fmt_trans) > 0:
             fmt = [fmt_trans, fmt]