On Mon, Jun 15, 2015 at 3:22 AM, Lucas Stach <[email protected]> wrote:

> Given that this patch is really trivial, I'm going to push this by
> tomorrow if nobody objects.
>
> Regards,
> Lucas
>
> Am Montag, den 08.06.2015, 12:45 +0200 schrieb Lucas Stach:
> > If the test don't require specific extensions a NULL ptr is
> > passed to the initial call of strtok(). Apparently this works on
> > x86, but it is undocumented behavior and crashes on other arches.
> >
> > Fix the segfault by bailing out early in this case.
>

didn't find anything explicit about the arguments on the first call in the
manpage, so I guess it's legal to crash on NULL.

Reviewed-by: Jan Vesely <[email protected]>


> >
> > Signed-off-by: Lucas Stach <[email protected]>
> > ---
> >  tests/util/piglit-framework-cl.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/tests/util/piglit-framework-cl.c
> b/tests/util/piglit-framework-cl.c
> > index 9a7efef1d93b..9dc73c7e3508 100644
> > --- a/tests/util/piglit-framework-cl.c
> > +++ b/tests/util/piglit-framework-cl.c
> > @@ -86,6 +86,9 @@ bool check_platform_extensions(cl_platform_id
> platform_id, char* extensions)
> >  {
> >       char* pch;
> >
> > +     if (!extensions)
> > +             return true;
> > +
> >       pch = strtok(extensions, " ");
> >       while(pch != NULL) {
> >               if(   strlen(pch) > 0
> > @@ -108,6 +111,9 @@ bool check_device_extensions(cl_device_id device_id,
> char* extensions)
> >  {
> >       char* pch;
> >
> > +     if (!extensions)
> > +             return true;
> > +
> >       pch = strtok(extensions, " ");
> >       while(pch != NULL) {
> >               if(   strlen(pch) > 0
>
> --
> Pengutronix e.K.             | Lucas Stach                 |
> Industrial Linux Solutions   | http://www.pengutronix.de/  |
>
> _______________________________________________
> Piglit mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to