Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving
From: Jiri Olsa
Date: Sat Jul 16 2016 - 11:58:19 EST
On Fri, Jul 15, 2016 at 01:18:40PM -0400, Steven Rostedt wrote:
> On Fri, 15 Jul 2016 09:29:55 +0200
> Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>
> > + if (field->flags & FIELD_IS_STRING &&
> > + is_printable_array(data + offset, len)) {
> > + obj = PyString_FromString((char *) data + offset);
>
> Hmm. As I stated, It is possible that strings can be non nul
> terminated. But I'm looking here and thinking we need to make sure that
> it is nul terminated.
>
> Can PyString_FromString() handle a non nul terminated string?
couldn't find in the doc.. but I think it's necessary,
there's no other way it could tell the end ;-)
I'll make the is_printable_array in case the final 0 is missing
thanks,
jirka