[Mono-dev] GetFileSystemEntries() can return null, but very few null checks

Rob Wilkens robwilkens at gmail.com
Sat Jun 9 00:48:30 UTC 2012


I may not be an expert, but i'd definitely file a bug report this way at 
minimum it gets tracked.  I'd copy and paste exactly what you wrote in 
this e-mail into that problem report.


On 06/08/2012 08:43 PM, Steven Boswell II wrote:
> Today, rather randomly, I got an unhandled NullReferenceException in 
> mcs/class/System/System.IO/DefaultWatcher.cs at line 221 -- "files" 
> was null.  All the places that "files" gets set can't be null, except 
> for the one on line 204, a call to Directory.GetFileSystemEntries(). 
>  That led to mcs/class/corlib/System.IO/Directory.cs line 497, which 
> led to mcs/class/corlib/System.IO/MonoIO.cs line 177, which led to a C 
> function called ves_icall_System_IO_MonoIO_GetFileSystemEntries(), 
> which starts at line 319 of mono/metadata/file-io.c .  That function 
> can return null in several different ways.
>
> Looking around, this seems to be a general problem...
>
> Files that call GetFileSystemEntries() and check for null:
> mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
>
> Files that call GetFileSystemEntries() without checking for null:
> mcs/class/Compat.ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib/Tar/TarEntry.cs
> mcs/class/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib/Tar/TarEntry.cs
> mcs/class/Microsoft.Build.Utilities/Mono.XBuild.Utilities/MSBuildUtils.cs
> mcs/class/Mono.Posix/Mono.Unix/UnixDirectoryInfo.cs
> mcs/class/System/System.IO/DefaultWatcher.cs
> mcs/tools/macpack/MacPack.cs
> mcs/tools/monodoc/Lucene.Net/Lucene.Net/SupportClass.cs
>
> Files with a GetFileSystemEntries() that can return null:
> mcs/class/corlib/Linux/Linux.cs
> mono/metadata/file-io.c
>
> If fixing this is as simple as adding null checks to the affected 
> areas, I can crank that out and submit a patch.  Otherwise, someone 
> more knowledgeable than me needs to look into this.
>
> I don't see any bug reports in either bugzilla.novell.com or 
> bugzilla.xamarin.com about this issue.  I searched "Mono class 
> libraries" and "Mono runtime".  There were a few other issues related 
> to GetFileSystemEntries(), but none that sounded like this.  So I 
> filed one... https://bugzilla.xamarin.com/show_bug.cgi?id=5591 .
>
> Steven Boswell
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120608/08397a49/attachment.html>


More information about the Mono-devel-list mailing list