Closed Bug 98705 Opened 23 years ago Closed 23 years ago

The Netscape 4 plugins do not work if the NPP_WriteReady returns values less the 16K

Categories

(Core Graveyard :: Plug-ins, defect, P2)

defect

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.5

People

(Reporter: amardare, Assigned: peterlubczynski-bugs)

Details

Attachments

(1 file)

From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
BuildID:    000000000

I was writing a plugin for mozilla and NPP_WriteReady needs to return 4k in my 
case. I looked in the file 
mozilla\modules\plugin\base\src\ns4xPluginInstance.cpp in the function 
OnDataAvailable. Mozilla reads a buffer of 16k of data and if NPP_WriteReady 
returns less than 16k, it needs to shift the data in the mStreamBuffer. Mozilla 
does this by calling
strncpy(mStreamBuffer,mStreamBuffer+writeCount,amountRead);
which is wrong because strncpy is not supposed to be used for overlapping 
memory.
I replaced that call with
memmove(mStreamBuffer,mStreamBuffer+writeCount,amountRead);
and the plugin plays well.
Can you please confirm/correct this problem?

Reproducible: Always
Steps to Reproduce:
1. Use a plugin that returns less than 16k as NPP_WriteReady
2.
3.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Reporter, thanks for pointing this out. Peter, looks like this is trivial fix in
what you did some time ago for NPP_WriteReady. Setting 0.9.5 for now but maybe
we should consider it for the branch.
Priority: -- → P2
Hardware: PC → All
Target Milestone: --- → mozilla0.9.5
Yeah, this seems pretty simple to do.

Is all what needs to be done is s/strncpy/memmove?
Assignee: av → peterlubczynski
Keywords: nsbranch
Status: NEW → ASSIGNED
Keywords: patch
Whiteboard: [seeking reviews]
Seems right thing to do. r=av.
Comment on attachment 48811 [details] [diff] [review]
patch to use memove

sr=attinasi
Attachment #48811 - Flags: superreview+
a=roc+moz for the 0.9.4 branch
Fix checked in to both trunk and branch, marking FIXED.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Whiteboard: [seeking reviews]
v
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: