Series is:

Reviewed-by: Samuel Iglesias Gonsálvez <sigles...@igalia.com>

On Thu, 2017-04-06 at 13:37 -0700, Jordan Justen wrote:
> 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.jus...@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");

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to