mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-09 16:57:36 +00:00
Fixes bug 89397. This fixes a problem where byteranges which start at offest 0 do not reset the mPosition. This cause byte to be written at random places in the file.
r=peterl, r=av, sr=attinasi
This commit is contained in:
parent
0929067509
commit
fc68b1ad26
@ -56,6 +56,7 @@ ns4xPluginStreamListener::ns4xPluginStreamListener(nsIPluginInstance* inst,
|
||||
mInst = (ns4xPluginInstance*) inst;
|
||||
mStreamBuffer=nsnull;
|
||||
mPosition = 0;
|
||||
mCurrentStreamOffset = -1;
|
||||
// Initialize the 4.x interface structure
|
||||
memset(&mNPStream, 0, sizeof(mNPStream));
|
||||
|
||||
@ -291,10 +292,13 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
|
||||
PRUint32 leftToRead = 0; // just in case OnDataaAvail tries to overflow our buffer
|
||||
PRBool createdHere = PR_FALSE; // we did malloc in locally, so we must free locally
|
||||
|
||||
// we are getting a range request, reset mPosition since postion passed to plugin will
|
||||
// be relative to the absolute position of the file.
|
||||
if (sourceOffset != 0)
|
||||
// if we are getting a range request, reset mPosition.
|
||||
if (sourceOffset != mCurrentStreamOffset ||
|
||||
mCurrentStreamOffset == -1 )
|
||||
{
|
||||
mPosition = 0;
|
||||
mCurrentStreamOffset = sourceOffset;
|
||||
}
|
||||
|
||||
pluginInfo->GetURL(&mNPStream.url);
|
||||
pluginInfo->GetLastModified((PRUint32*)&(mNPStream.lastmodified));
|
||||
|
@ -55,6 +55,7 @@ protected:
|
||||
ns4xPluginInstance* mInst;
|
||||
NPStream mNPStream;
|
||||
PRUint32 mPosition;
|
||||
PRUint32 mCurrentStreamOffset;
|
||||
nsPluginStreamType mStreamType;
|
||||
|
||||
public:
|
||||
|
@ -56,6 +56,7 @@ ns4xPluginStreamListener::ns4xPluginStreamListener(nsIPluginInstance* inst,
|
||||
mInst = (ns4xPluginInstance*) inst;
|
||||
mStreamBuffer=nsnull;
|
||||
mPosition = 0;
|
||||
mCurrentStreamOffset = -1;
|
||||
// Initialize the 4.x interface structure
|
||||
memset(&mNPStream, 0, sizeof(mNPStream));
|
||||
|
||||
@ -291,10 +292,13 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
|
||||
PRUint32 leftToRead = 0; // just in case OnDataaAvail tries to overflow our buffer
|
||||
PRBool createdHere = PR_FALSE; // we did malloc in locally, so we must free locally
|
||||
|
||||
// we are getting a range request, reset mPosition since postion passed to plugin will
|
||||
// be relative to the absolute position of the file.
|
||||
if (sourceOffset != 0)
|
||||
// if we are getting a range request, reset mPosition.
|
||||
if (sourceOffset != mCurrentStreamOffset ||
|
||||
mCurrentStreamOffset == -1 )
|
||||
{
|
||||
mPosition = 0;
|
||||
mCurrentStreamOffset = sourceOffset;
|
||||
}
|
||||
|
||||
pluginInfo->GetURL(&mNPStream.url);
|
||||
pluginInfo->GetLastModified((PRUint32*)&(mNPStream.lastmodified));
|
||||
|
@ -55,6 +55,7 @@ protected:
|
||||
ns4xPluginInstance* mInst;
|
||||
NPStream mNPStream;
|
||||
PRUint32 mPosition;
|
||||
PRUint32 mCurrentStreamOffset;
|
||||
nsPluginStreamType mStreamType;
|
||||
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user