Skip to content

setenv crashes with UTF-8 string #765

@xRandomGuy

Description

@xRandomGuy

When JRuby is reading all envs, passing UTF-8 string to setenv crashes with IllegalArgumentException.

java.lang.IllegalArgumentException
        at java.nio.Buffer.position(Buffer.java:236)
!       at jnr.ffi.provider.converters.CharSequenceParameterConverter.toNative(CharSequenceParameterConverter.java:125)
        at jnr.posix.LinuxLibC$jnr$ffi$0.setenv(Unknown Source)
        at jnr.posix.BaseNativePOSIX.setenv(BaseNativePOSIX.java:303)
        at jnr.posix.CheckedPOSIX.setenv(CheckedPOSIX.java:301)
        at jnr.posix.LazyPOSIX.setenv(LazyPOSIX.java:303)
!       at org.jruby.RubyGlobal$StringOnlyRubyHash.case_aware_op_aset(RubyGlobal.java:424)
        at org.jruby.RubyGlobal$CaseInsensitiveStringOnlyRubyHash.op_aset(RubyGlobal.java:335)
        at org.jruby.RubyGlobal$StringOnlyRubyHash.op_aset19(RubyGlobal.java:387)
        at org.jruby.RubyHash$28.visit(RubyHash.java:1793)
        at org.jruby.RubyHash.visitAll(RubyHash.java:636)
        at org.jruby.RubyHash.replaceCommon19(RubyHash.java:1837)
        at org.jruby.RubyHash.replace19(RubyHash.java:1791)
        at org.jruby.RubyHash$INVOKER$i$1$0$replace19.call(RubyHash$INVOKER$i$1$0$replace19.gen)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
        at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions