Closed Bug 58191 Opened 24 years ago Closed 24 years ago

Wstring passed from C++ to Java with extra garbage symbols

Categories

(Core Graveyard :: Java to XPCOM Bridge, defect, P3)

x86
Linux
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: avm, Assigned: blackconnect)

Details

If XPCOM component has some method with "out" parameter wstring,
(for eg. void TestWString(out wstring i);)
And somebody tried to call this method from Java, then extra 
garbage symbols will be passed to Java.

For example if in native code you put "Some test string" then
in Java code you may got "Some test string?w0w0.."

Suggested reason:

In bcJavaMarshalToolkit::UnMarshalElement
"size of buffer" used to construct new jstring, but
really "size of buffer" = length * sizeof(PRUnichar) + 2
So we should use length = ("size of buffer" - 2)/sizeof(PRUnichar)
to construct jstring via env->NewString method.
fixed integrated into the trunc
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Work now. Mark VERIFIED
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.