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.
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.
Yeah, this seems pretty simple to do. Is all what needs to be done is s/strncpy/memmove?
Seems right thing to do. r=av.
Comment on attachment 48811 [details] [diff] [review] patch to use memove sr=attinasi
a=roc+moz for the 0.9.4 branch
Fix checked in to both trunk and branch, marking FIXED.