If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

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

VERIFIED FIXED

Status

Core Graveyard
Java to XPCOM Bridge
P3
normal
VERIFIED FIXED
17 years ago
3 years ago

People

(Reporter: Alexei V. Mokeev, Assigned: Igor Kushnirskiy)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

17 years ago
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.
(Assignee)

Comment 1

17 years ago
fixed integrated into the trunc
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED
(Reporter)

Comment 2

16 years ago
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.