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

VERIFIED FIXED in mozilla0.9.5

Status

()

Core
Plug-ins
P2
normal
VERIFIED FIXED
16 years ago
15 years ago

People

(Reporter: amardare, Assigned: Peter Lubczynski)

Tracking

Trunk
mozilla0.9.5
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

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

Comment 1

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

Comment 2

16 years ago
Yeah, this seems pretty simple to do.

Is all what needs to be done is s/strncpy/memmove?
Assignee: av → peterlubczynski
Keywords: nsbranch
(Assignee)

Comment 3

16 years ago
Created attachment 48811 [details] [diff] [review]
patch to use memove
(Assignee)

Updated

16 years ago
Status: NEW → ASSIGNED
Keywords: patch
Whiteboard: [seeking reviews]

Comment 4

16 years ago
Seems right thing to do. r=av.

Comment 5

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

Comment 7

16 years ago
Fix checked in to both trunk and branch, marking FIXED.
Status: ASSIGNED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED
Whiteboard: [seeking reviews]

Comment 8

15 years ago
v
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.