[Mono-bugs] [Bug 504791] NRE in FileSystem.FileOpen due to compiler problem

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon May 18 11:11:00 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=504791

User andyhume32 at yahoo.co.uk added comment
http://bugzilla.novell.com/show_bug.cgi?id=504791#c1





--- Comment #1 from Andy Hume <andyhume32 at yahoo.co.uk>  2009-05-18 09:10:58 MDT ---
The original source is:
[[
  If FileNumber <= 0 _
       OrElse FileNumber > 255 _
       OrElse (Not m_OpenFiles Is Nothing AndAlso _
               m_OpenFiles.ContainsKey(FileNumber)) Then
     Throw ...
  End If
]]

Viewing the IL in the Microsoft.Visual.Basic.dll assembly installed by Mono
(2.4; with a quick check >=2.0 is bad, 1.9 is ok, <1.9 is NotImpl) with
Reflector shows:
[[
    If (IIf(((FileNumber <= 0) OrElse (FileNumber > &HFF)), 1, 0) = 0) Then
    End If
    If (IIf((IIf((
        (FileSystem.m_OpenFiles Is Nothing) _
         AndAlso FileSystem.m_OpenFiles.ContainsKey(FileNumber)), _
           1, 0) = 0), 1, 0) <> 0) Then
      Throw ...
    End If
]]

So the first two clauses have been ignored (thus an illegal FileNumber will
never be detected), and more pertantly the "Not" in the null check has gone
missing (possibly applied to the AndAlso result???).

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


More information about the mono-bugs mailing list