[Mesa-dev] [PATCH v2] glsl/blob: handle NULL ptr in blob_write_string/blob_read_string

gregory hainaut gregory.hainaut at gmail.com
Wed Apr 5 06:41:50 UTC 2017


On Wed, 5 Apr 2017 09:09:45 +1000
Timothy Arceri <tarceri at itsqueeze.com> wrote:

> On 05/04/17 02:29, Gregory Hainaut wrote:
> > Context:
> > Nouveau uses NULL strings for unnamed parameter of texture gather
> > offsets opcode.
> >
> > Fix piglit crashes of the 'texturegatheroffsets' tests on Nouveau
> >
> > v2: based on Nicolai feedback
> 
> Hi Gregory,
> 
> Nicolai suggested you change the caller of create a new helper function 
> for the case where string can be NULL. e.g blob_write_optional_string()
> 
> The change below causes an extra read/write which is not required for 
> ever other use of this function. Please create the additional function 
> as a wrapper around blob_write_string()
> 
> Thanks,
> Tim
> 

Hello Timothy,

I will change it. 

However what do you want to do if blob_write_string is called
with a null pointer ? Do you prefer
* Crash
* Assert
* Report an internal error message

I'm leading toward the latter but I'm afraid it might either corrupt
the cache (if we skip the string write or use an empty string). Well we
could just report an error before the crash too.

Best regards,
Gregory


More information about the mesa-dev mailing list