Clayton Wheeler created JRUBY-6662:
--------------------------------------

             Summary: rb_string_value_cstr incorrectly rejects Unicode strings
                 Key: JRUBY-6662
                 URL: https://jira.codehaus.org/browse/JRUBY-6662
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6.7
         Environment: JRuby 1.6.7 on Mac OS X 10.7.3, Java 1.6.0_31 64-bit 
server VM
            Reporter: Clayton Wheeler
            Assignee: Thomas E Enebo


A BioRuby test for XML processing (test/unit/bio/db/test_phyloxml.rb:104) fails 
on JRuby with libxml-ruby with ArgumentError: string contains NULL byte when 
calling the XML::Reader.string method, defined in native code, with a Unicode 
string. This string does not contain a null byte, but it is a UTF-8 string.

The JRuby implementation of rb_string_value_cstr appears to give this error 
when the Ruby string length and the C strlen(3) length differ, without 
explicitly checking for a null byte. I would expect this to cause problems with 
UTF-8 strings containing multibyte characters.

This same problem can be observed in the libxml-ruby unit tests; test_base_uri 
in test/tc_reader.rb fails for the same reason.

There are no RubySpecs exercising rb_string_value_cstr AKA StringValueCStr; it 
would be good if there was one but I'm not familiar enough with the Ruby C API 
to write it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to