This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Skip the length sanity check if d_name is pointer or less.
authorJarkko Hietaniemi <jhi@iki.fi>
Sun, 14 Feb 2016 00:34:20 +0000 (19:34 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 14 Feb 2016 13:32:35 +0000 (08:32 -0500)
[perl #127511] v5.23.7-308-g1d41bb7 broke t/op/threads-dirh.t on solaris threaded builds

In other words, skip it if the dirent->d_name is a pointer (char *)
or less (struct-final char d_name[1], as it seems to be in Solaris).

The length sanity check is meant for places where the d_name is
a true array.

Follow-up to 1d41bb72.

sv.c

diff --git a/sv.c b/sv.c
index c214c99..819a250 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -13108,7 +13108,7 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const param)
     pos = PerlDir_tell(dp);
     if ((dirent = PerlDir_read(dp))) {
        len = d_namlen(dirent);
-        if (len > sizeof(dirent->d_name)) {
+        if (len > sizeof(dirent->d_name) && sizeof(dirent->d_name) > PTRSIZE) {
             /* If the len is somehow magically longer than the
              * maximum length of the directory entry, even though
              * we could fit it in a buffer, we could not copy it