Forum: Ruby-core [ruby-trunk - Bug #7526][Open] infinit loop in Registry::each_value

Posted by rubyhack (first last) (Guest)
on 2012-12-06 12:04
(Received via mailing list)
Issue #7526 has been reported by rubyhack (first last).

----------------------------------------
Bug #7526: infinit loop in Registry::each_value
https://bugs.ruby-lang.org/issues/7526

Author: rubyhack (first last)
Status: Open
Priority: Normal
Assignee:
Category: lib
Target version:
ruby -v: All


in win32/registry.rb :
        begin
          type, data = read(subkey)
        rescue Error
          next
        end
the correction :
        rescue Error
          index += 1
          next
        end

I think that using Registry::info to get the number of values (also 
number of subkeys in each_key)
is a better solution so to skip problematic values.

also a limitation in Registry::read
      when REG_BINARY
        [ type, data ]

should be :
      when REG_BINARY, REG_NONE, REG_LINK, REG_RESOURCE_LIST, 
REG_RESOURCE_REQUIREMENTS_LIST
        [ type, data ]

instead of raising an exception for those types (in regedit.exe REG_NONE 
is equivalent to REG_BINARY)
Posted by rubyhack (first last) (Guest)
on 2012-12-24 10:12
(Received via mailing list)
Issue #7526 has been updated by rubyhack (first last).


rubyhack (first last) wrote:
> the correction :
>         rescue Error
>           index += 1
>           next
>         end

that is: add only the line: "index += 1" to the lib and the bug is fixed

----------------------------------------
Bug #7526: infinit loop in Registry::each_value
https://bugs.ruby-lang.org/issues/7526#change-35044

Author: rubyhack (first last)
Status: Assigned
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category: lib
Target version: 2.0.0
ruby -v: All


in win32/registry.rb :
        begin
          type, data = read(subkey)
        rescue Error
          next
        end
the correction :
        rescue Error
          index += 1
          next
        end

I think that using Registry::info to get the number of values (also 
number of subkeys in each_key)
is a better solution so to skip problematic values.

also a limitation in Registry::read
      when REG_BINARY
        [ type, data ]

should be :
      when REG_BINARY, REG_NONE, REG_LINK, REG_RESOURCE_LIST, 
REG_RESOURCE_REQUIREMENTS_LIST
        [ type, data ]

instead of raising an exception for those types (in regedit.exe REG_NONE 
is equivalent to REG_BINARY)
Posted by mame (Yusuke Endoh) (Guest)
on 2013-02-18 16:49
(Received via mailing list)
Issue #7526 has been updated by mame (Yusuke Endoh).

Target version changed from 2.0.0 to next minor

Let me know if there is any popular application that suffers from this 
issue.

--
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Bug #7526: infinit loop in Registry::each_value
https://bugs.ruby-lang.org/issues/7526#change-36550

Author: rubyhack (first last)
Status: Assigned
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category: lib
Target version: next minor
ruby -v: All


in win32/registry.rb :
        begin
          type, data = read(subkey)
        rescue Error
          next
        end
the correction :
        rescue Error
          index += 1
          next
        end

I think that using Registry::info to get the number of values (also 
number of subkeys in each_key)
is a better solution so to skip problematic values.

also a limitation in Registry::read
      when REG_BINARY
        [ type, data ]

should be :
      when REG_BINARY, REG_NONE, REG_LINK, REG_RESOURCE_LIST, 
REG_RESOURCE_REQUIREMENTS_LIST
        [ type, data ]

instead of raising an exception for those types (in regedit.exe REG_NONE 
is equivalent to REG_BINARY)
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.