[Mono-bugs] [Bug 676934] New: Directory.GetFiles dies with StackOverflowException when trying to inspect a file

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Mar 4 04:00:59 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=676934

https://bugzilla.novell.com/show_bug.cgi?id=676934#c0


           Summary: Directory.GetFiles dies with StackOverflowException
                    when trying to inspect a file
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.10.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: david at dasz.at
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=417534)
 --> (http://bugzilla.novell.com/attachment.cgi?id=417534)
the failing solution

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13

When trying to search for files with Directory.GetFiles and accidentally
referencing a file instead of a directory, the internally used
Directory.GetFilesRecurse method dies with a StackOverflowException. The
Microsoft implementation throws a 

  System.IO.IOException:
    Message=The directory name is invalid.

instead.



Reproducible: Always

Steps to Reproduce:
See attached solution.
Actual Results:  
Stack overflow: IP: 0x5e068b, fault addr: (nil)
Stacktrace:
  at (wrapper alloc) object.Alloc (intptr,int) <IL 0x00059, 0xffffffff>
  <...>
  at string.SubstringUnchecked (int,int) [0x0000c] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System/String.cs:351
  at string.Substring (int,int) [0x0007c] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System/String.cs:341
  at System.IO.Path.GetDirectoryName (string) [0x00088] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System.IO/Path.cs:219
  at System.IO.Directory.ValidateDirectoryListing (string,string,bool&)
[0x0000e] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System.IO/Directory.cs:457
  at System.IO.Directory.GetFileSystemEntries
(string,string,System.IO.FileAttributes,System.IO.FileAttributes) [0x00023] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System.IO/Directory.cs:494
  at System.IO.Directory.GetDirectories (string,string) [0x00000] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System.IO/Directory.cs:261
  at System.IO.Directory.GetDirectories (string) [0x00000] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System.IO/Directory.cs:256
  at System.IO.Directory.GetFilesRecurse
(string,string,System.Collections.Generic.List`1<string>) [0x00000] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System.IO/Directory.cs:313
  at System.IO.Directory.GetFilesRecurse
(string,string,System.Collections.Generic.List`1<string>) [0x0001f] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System.IO/Directory.cs:315
  at System.IO.Directory.GetFilesRecurse
(string,string,System.Collections.Generic.List`1<string>) [0x0001f] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System.IO/Directory.cs:315
  at System.IO.Directory.GetFilesRecurse
(string,string,System.Collections.Generic.List`1<string>) [0x0001f] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System.IO/Directory.cs:315
  at System.IO.Directory.GetFilesRecurse
(string,string,System.Collections.Generic.List`1<string>) [0x0001f] in
/srv/CCNet/mono/src/mono.local/mcs/class/corlib/System.IO/Directory.cs:315


Expected Results:  
Throw a IOException.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list