Wrong url loaded by Webclient in some cases

VERIFIED FIXED

Status

P3
normal
VERIFIED FIXED
19 years ago
7 years ago

People

(Reporter: avm, Assigned: edburns)

Tracking

Trunk
x86
Windows NT

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

19 years ago
In some cases the test application, that uses Webclient API loads URLs with some
garbage. For exmple when i try to load "www.sun.com/" via Navigation.loadURL
then really "www.sun.com/sdajkfgas_SomeGarbage_dfrfdf" loaded.

Supposed reason:

When constructing wsLoadURLEvent webclient use the buffer of PRUnichar to
construct nsString.
But early this PRUnichar array was recieved via env->GetStringChars(inString,0)
and may be or may be NOT 0-terminated. And when constructing nsString from
not 0-terminated string we can get some GARBAGE from memory.
This problem is well reproduced with jdk1.2.2SE, latest Webclient and Mozilla
M16. 
Also this problem can be reproduced with jdk1.2.2 and Mozilla M13
(Assignee)

Comment 1

19 years ago
Accept
Status: NEW → ASSIGNED
(Assignee)

Comment 2

18 years ago
I can't reproduce this.  And your explanation doesn't fit the code.  We just 
get back a string:

PRUnichar*	urlStringChars = (PRUnichar *) ::util_GetStringChars(env,
                                                                  urlString);

This goes to env->GetStringChars().  We have no control over what this returns.
If there is garbage, it's a JNI bug.

Can you please help me reproduce this?
Status: ASSIGNED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → WORKSFORME
(Reporter)

Comment 3

18 years ago
Yes, this bug is hard to reproduce. But this is not jni bug, but
documented jni feature: env->GetStringChars() can return 
0-terminated OR not 0-terminated array. 
And in our case we must use additional "length" parameter to construct 
right nsString from PRUnichar array. 
In attachment please see the simple jni testcase, that shows that 
array, returned by env->GetStringChars is not 0-terminated.
To run this testcase please untar it, build under win32 and run NativeTest 
class.
(Reporter)

Comment 4

18 years ago
Created attachment 12169 [details]
Simple testcase on GetStringChars
(Reporter)

Comment 5

18 years ago
Additional info: testcase from 07/31/00 05:39 in .tar.gz format
(Reporter)

Comment 6

18 years ago
Created attachment 12748 [details] [diff] [review]
Supposed fix.
(Assignee)

Comment 7

18 years ago
The fix looks fine, but the only thing that remains is to make it compatible 
with webclient in StarOffice.  I can do that.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
(Assignee)

Comment 8

18 years ago
Fix checked in.
Status: REOPENED → RESOLVED
Last Resolved: 18 years ago18 years ago
Resolution: --- → FIXED

Comment 9

18 years ago
*** Bug 59242 has been marked as a duplicate of this bug. ***
(Reporter)

Comment 10

17 years ago
VERIFIED with JAVADEV_6_1_20010831 and Netscape61_RELEASE.
Status: RESOLVED → VERIFIED

Updated

17 years ago
QA Contact: geetha.vaidyanaathan → avm
Component: Java APIs to WebShell → Java APIs to WebShell
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.