[Mesa-dev] [PATCH 1/2] intel/aubinator_error_decode: Avoid printing long ascii85 lines

Jordan Justen jordan.l.justen at intel.com
Thu Apr 6 20:37:54 UTC 2017


Since '---' can exist within an ascii85 encoded string, we should
avoid these strings when looking for header lines in the error state
file.

One of the things we do inside the 'if (dashes) {' block is to print
the entire line. Since these the ascii85 lines are extremely long it
makes it difficult to then view the aubinator_error_decode output.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/intel/tools/aubinator_error_decode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/intel/tools/aubinator_error_decode.c b/src/intel/tools/aubinator_error_decode.c
index 2e623698ed1..21386fef8a9 100644
--- a/src/intel/tools/aubinator_error_decode.c
+++ b/src/intel/tools/aubinator_error_decode.c
@@ -349,6 +349,7 @@ read_data_file(FILE *file)
    while (getline(&line, &line_size, file) > 0) {
       char *new_ring_name = NULL;
       char *dashes;
+      bool ascii85_start = line[0] == ':' || line[0] == '~';
       line_number++;
 
       if (sscanf(line, "%m[^ ] command stream\n", &new_ring_name) > 0) {
@@ -356,7 +357,7 @@ read_data_file(FILE *file)
          ring_name = new_ring_name;
       }
 
-      dashes = strstr(line, "---");
+      dashes = !ascii85_start || line_size < 256 ? strstr(line, "---") : NULL;
       if (dashes) {
          uint32_t lo, hi;
          char *new_ring_name = malloc(dashes - line);
@@ -423,7 +424,7 @@ read_data_file(FILE *file)
          }
       }
 
-      if (line[0] == ':' || line[0] == '~') {
+      if (ascii85_start) {
          count = ascii85_decode(line+1, &data, line[0] == ':');
          if (count == 0) {
             fprintf(stderr, "ASCII85 decode failed.\n");
-- 
2.11.0



More information about the mesa-dev mailing list