Menu

#882 REDIM (sizing) does not check the right of access to the default constructor

closed
nobody
compiler
2020-09-20
2018-06-13
No

When REDIM is used for [re]sizing an array, it constructs the new array elements without checking the right of access to the default constructor.

Example:

Type UDT
  Public:
    Dim As Integer I = 123
  Private:
    Declare Constructor ()
End Type

Constructor UDT ()
  Print "Private access!"
End Constructor

'Dim As UDT u1                 '' OK - error 204: The default constructor has no public access
'Dim As UDT u2(0)              '' OK - error 204: The default constructor has no public access
'Dim As UDT Ptr pu1 = New UDT  '' OK - error 204: The default constructor has no public access

Dim AS UDT u3()                '' OK - Because no construction
Redim u3(0)                    '' NOK - The default constructor has no public access
Print u3(0).I
Print
Redim As UDT u4(0)             '' NOK - The default constructor has no public access
Print u4(0).I

Sleep

Discussion

  • Jeff Marshall

    Jeff Marshall - 2020-09-20
    • status: open --> closed
     
  • Jeff Marshall

    Jeff Marshall - 2020-09-20

    fixed in [975f41]

    REDIM [PRESERVE] will check access rights

     

    Related

    Commit: [975f41]


Log in to post a comment.

MongoDB Logo MongoDB