diff options
author | Marcus Holland-Moritz <mhx-perl@gmx.net> | 2003-08-01 15:12:14 +0200 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-08-02 06:24:30 +0000 |
commit | e0e8a4dc9991fe9a8553e925ddf6f3ae1363478f (patch) | |
tree | 5575e1b288438059a9f78ed3e0bcad1f4912c943 /ext/File | |
parent | dfffa540bcf4c6b6be7ce9fe4c8ed1d45c6989ba (diff) | |
download | perl-e0e8a4dc9991fe9a8553e925ddf6f3ae1363478f.tar.gz |
Re: [perl #23185] perl crash with File::Glob
From: "Marcus Holland-Moritz" <mhx-perl@gmx.net>
Message-ID: <00dc01c3581d$c3412c30$0c2f1fac@R2D2>
p4raw-id: //depot/perl@20445
Diffstat (limited to 'ext/File')
-rw-r--r-- | ext/File/Glob/Glob.pm | 1 | ||||
-rw-r--r-- | ext/File/Glob/bsd_glob.c | 7 | ||||
-rwxr-xr-x | ext/File/Glob/t/basic.t | 6 |
3 files changed, 13 insertions, 1 deletions
diff --git a/ext/File/Glob/Glob.pm b/ext/File/Glob/Glob.pm index a704b567bb..d670b6ae7b 100644 --- a/ext/File/Glob/Glob.pm +++ b/ext/File/Glob/Glob.pm @@ -125,6 +125,7 @@ sub bsd_glob { # File::Glob::glob() is deprecated because its prototype is different from # CORE::glob() (use bsd_glob() instead) sub glob { + splice @_, 1; # don't pass PL_glob_index as flags! goto &bsd_glob; } diff --git a/ext/File/Glob/bsd_glob.c b/ext/File/Glob/bsd_glob.c index 83d71f0b0f..c01e75a6e1 100644 --- a/ext/File/Glob/bsd_glob.c +++ b/ext/File/Glob/bsd_glob.c @@ -261,12 +261,19 @@ bsd_glob(const char *pattern, int flags, #ifndef MACOS_TRADITIONAL patnext = (U8 *) pattern; #endif + /* TODO: GLOB_APPEND / GLOB_DOOFFS aren't supported yet */ +#if 0 if (!(flags & GLOB_APPEND)) { pglob->gl_pathc = 0; pglob->gl_pathv = NULL; if (!(flags & GLOB_DOOFFS)) pglob->gl_offs = 0; } +#else + pglob->gl_pathc = 0; + pglob->gl_pathv = NULL; + pglob->gl_offs = 0; +#endif pglob->gl_flags = flags & ~GLOB_MAGCHAR; pglob->gl_errfunc = errfunc; pglob->gl_matchc = 0; diff --git a/ext/File/Glob/t/basic.t b/ext/File/Glob/t/basic.t index 91f79138d6..00bd740612 100755 --- a/ext/File/Glob/t/basic.t +++ b/ext/File/Glob/t/basic.t @@ -13,7 +13,7 @@ BEGIN { print "1..0\n"; exit 0; } - print "1..11\n"; + print "1..12\n"; } END { print "not ok 1\n" unless $loaded; @@ -182,3 +182,7 @@ print $ok ? "ok 11\n" : "not ok 11\n"; unlink @f_names; chdir ".."; rmdir "pteerslo"; + +# this can panic if PL_glob_index gets passed as flags to bsd_glob +<*>; <*>; +print "ok 12\n"; |