Skip to content
  • Mike Dalessio's avatar
    4cce246d
    [ruby/rdoc] ClassModule#superclass= accepts a ClassModule as an · 4cce246d
    Mike Dalessio authored
    argument
    (https://github.com/ruby/rdoc/pull/1222)
    
    It is necessary for ClassModule's instance variable @superclass to
    always be a String (or nil) so that the class can be saved with
    `#marshal_dump` and loaded with `#marshal_load`.
    
    However, there's no type checking being done, which allows a bug like
    the one reported in #1221 (which was introduced in #1217) that sets
    superclass to a ClassModule. That bug requires:
    
    - setting a superclass to a NormalClass
    - marshal_save
    - marshal_load (which raises an exception)
    
    With this change, passing a ClassModule to ClassModule#superclass= is
    explicitly allowed by saving the full name of the ClassModule in the
    @superclass instance variable.
    
    https://github.com/ruby/rdoc/commit/9ced6d534c
    4cce246d
    [ruby/rdoc] ClassModule#superclass= accepts a ClassModule as an
    Mike Dalessio authored
    argument
    (https://github.com/ruby/rdoc/pull/1222)
    
    It is necessary for ClassModule's instance variable @superclass to
    always be a String (or nil) so that the class can be saved with
    `#marshal_dump` and loaded with `#marshal_load`.
    
    However, there's no type checking being done, which allows a bug like
    the one reported in #1221 (which was introduced in #1217) that sets
    superclass to a ClassModule. That bug requires:
    
    - setting a superclass to a NormalClass
    - marshal_save
    - marshal_load (which raises an exception)
    
    With this change, passing a ClassModule to ClassModule#superclass= is
    explicitly allowed by saving the full name of the ClassModule in the
    @superclass instance variable.
    
    https://github.com/ruby/rdoc/commit/9ced6d534c
Loading