Control: reopen -1

On 2016-01-23 21:57:29 -0500, James McCoy wrote:
> On Fri, Jan 22, 2016 at 11:04:04AM +0100, Vincent Lefevre wrote:
> > $ perl -MSVN::Core -e 'SVN::Core::dirent_canonicalize(undef)'
> > zsh: segmentation fault (core dumped)  perl -MSVN::Core -e 
> > 'SVN::Core::dirent_canonicalize(undef)'
> > 
> > In case of undef, I suppose that the Perl module should pass the empty
> > string to the library (for which there are no errors), or return some
> > other kind of error.
> 
> As stated previously, and described on the Subversion dev list, the SWIG
> bindings are very thin wrappers around the C library.  Calling
> svn_dirent_canonicalize with a NULL dirent will result in the same
> behavior.

There's no such thing as a NULL dirent. In a string context, undef
is the empty string.

> This isn't unfounded behavior for libraries which are given invalid
> arguments (c.f., strlen(3)).

The argument is perfectly valid.

> > I have not tried other kinds of arguments, but in any case, the
> > module should make sure that a valid string is passed to the
> > library.
> 
> *You* are calling the library, so you need to ensure you give it a valid
> value.  undef (or the NULL pointer SWIG treats it as for a string
> argument) isn't a valid string.

No, undef must not be the null pointer. This makes no sense at all!
With a string argument, undef must be the empty string.

> To get the behavior you want, the suggestion upstream was that
> higher-level libraries would need to be developed.  That's not going to
> happen within Debian, so I'm closing the bug.

No need for a high-level library. This is just basic type analysis.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to