[Gambas-user] [CRASH REPORT] XmlElement.GetAttribute (gb.xml) segfault if the attribute is an empty string

Benoît Minisini gambas at ...1...
Fri Sep 16 02:26:19 CEST 2016


Le 13/09/2016 à 14:40, Adrien Prokopowicz a écrit :
>
> Damn Tobias, you're fast ! I saw your message just when I commited my
> fixes.
> I think that overwrote it, but thanks still. :)
>
> I took the opportunity to spread the fix to the .GetAttribute() method,
> which works
> the same way.
>
> However, this raised a question to me : Shouldn't be GB.ReturnNewString()
> return null
> when either the length or the value is null, instead of just crashing ?
>
> Regards,
>

GB.ReturnNewString() returns a void string only if its length argument 
is zero AND if its value argument is NULL.

If the length is zero, or lower than zero, and if the value is not NULL, 
then strlen() is called on the value.

It behaves like that to be backward-compatible with older version of Gambas.

But then it prints a big warning on the error output to ask to use 
GB.ReturnNewZeroString() instead.

Regards,

-- 
Benoît Minisini




More information about the User mailing list