[Mesa-dev] [PATCH 1/2] mesa: add blob overrun check to program binary reads
Gert Wollny
gw.fossdev at gmail.com
Fri Jan 26 09:24:01 UTC 2018
On 26.01.2018 01:56, Timothy Arceri wrote:
> ---
> src/mesa/main/program_binary.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/src/mesa/main/program_binary.c b/src/mesa/main/program_binary.c
> index 2786487362..68a15ec258 100644
> --- a/src/mesa/main/program_binary.c
> +++ b/src/mesa/main/program_binary.c
> @@ -287,5 +287,19 @@ _mesa_program_binary(struct gl_context *ctx, struct gl_shader_program *sh_prog,
> return;
> }
>
> + if (blob.current != blob.end || blob.overrun) {
> + /* Something has gone wrong ignore the binary and set link status to
> + * failure.
> + */
> + assert(!"Invalid program binary cache item!");
> +
> + if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {
> + fprintf(stderr, "Error reading program from program binary\n");
> + }
> + sh_prog->data->LinkStatus = linking_failure;
> +
> + return;
> + }
> +
> sh_prog->data->LinkStatus = linking_success;
> }
This code is nearly a complete duplicate of what is done in
"st_deserialise_tgsi_program", only there messages are different and
the LinkStatus is not set. Would it be possible to unify these two
pieces of code maybe in compiler/blob.h?
Best,
Gert
More information about the mesa-dev
mailing list