[Mesa-dev] [PATCH] mesa : NULL check InfoLog

Matt Turner mattst88 at gmail.com
Thu Jun 25 16:34:55 PDT 2015


On Tue, Jun 23, 2015 at 2:04 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Tue, Jun 23, 2015 at 4:03 AM, Marta Lofstedt
> <marta.lofstedt at linux.intel.com> wrote:
>> From: Marta Lofstedt <marta.lofstedt at intel.com>
>>
>> When a program is compiled, but linking failed the
>> sh->InfoLog could be NULL. This is expoloited

exploited is misspelled

>> by OpenGL ES 3.1 conformance tests.
>>
>> Signed-off-by: Marta Lofstedt <marta.lofstedt at intel.com>
>> ---
>>  src/mesa/main/shaderapi.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
>> index a4296ad..c783c69 100644
>> --- a/src/mesa/main/shaderapi.c
>> +++ b/src/mesa/main/shaderapi.c
>> @@ -1920,8 +1920,8 @@ _mesa_create_shader_program(struct gl_context* ctx, GLboolean separate,
>>             }
>>  #endif
>>          }
>> -
>> -        ralloc_strcat(&shProg->InfoLog, sh->InfoLog);
>> +         if (sh->InfoLog)
>> +                   ralloc_strcat(&shProg->InfoLog, sh->InfoLog);
>
> Wrong indentation on this line.
>
> Surely just not writing to the info log isn't the right fix? If it's
> null, shouldn't we instead ralloc_strdup() the string?

In the process of reading the second version of this patch, I realized
I had misread this as "if the existing log is empty, don't add
anything to the log", when in fact the code was "if there's no new
info, don't attempt to add new info"!

So this patch is correct as is.

Remove the space between "mesa" and ":" in the title, and maybe just
change the title to something like "mesa: Don't give ralloc_strcat a
NULL src."

With those changes, this is

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list