Bug 601261 - nsXPCOMDetector::DoIt didn't call Reset resulting in crash [@ nsSJISProber::HandleData]. r=emk

This commit is contained in:
Simon Montagu 2011-08-24 16:26:17 +09:00
parent 6a3fcc17e7
commit 9d90660cae
8 changed files with 14 additions and 0 deletions

View File

@ -77,6 +77,7 @@ CPPSRCS = \
$(NULL)
FORCE_STATIC_LIB = 1
LIBXUL_LIBRARY = 1
# This library is used by other shared libs in a static build
FORCE_USE_PIC = 1

View File

@ -36,6 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsBig5Prober.h"
#include "nsDebug.h"
void nsBig5Prober::Reset(void)
{
@ -46,6 +47,7 @@ void nsBig5Prober::Reset(void)
nsProbingState nsBig5Prober::HandleData(const char* aBuf, PRUint32 aLen)
{
NS_ASSERTION(aLen, "HandleData called with empty buffer");
nsSMState codingState;
for (PRUint32 i = 0; i < aLen; i++)

View File

@ -41,6 +41,7 @@
// 3, certain combination of kana is never used in japanese language
#include "nsEUCJPProber.h"
#include "nsDebug.h"
void nsEUCJPProber::Reset(void)
{
@ -52,6 +53,7 @@ void nsEUCJPProber::Reset(void)
nsProbingState nsEUCJPProber::HandleData(const char* aBuf, PRUint32 aLen)
{
NS_ASSERTION(aLen, "HandleData called with empty buffer");
nsSMState codingState;
for (PRUint32 i = 0; i < aLen; i++)

View File

@ -36,6 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsEUCKRProber.h"
#include "nsDebug.h"
void nsEUCKRProber::Reset(void)
{
@ -47,6 +48,7 @@ void nsEUCKRProber::Reset(void)
nsProbingState nsEUCKRProber::HandleData(const char* aBuf, PRUint32 aLen)
{
NS_ASSERTION(aLen, "HandleData called with empty buffer");
nsSMState codingState;
for (PRUint32 i = 0; i < aLen; i++)

View File

@ -36,6 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsEUCTWProber.h"
#include "nsDebug.h"
void nsEUCTWProber::Reset(void)
{
@ -47,6 +48,7 @@ void nsEUCTWProber::Reset(void)
nsProbingState nsEUCTWProber::HandleData(const char* aBuf, PRUint32 aLen)
{
NS_ASSERTION(aLen, "HandleData called with empty buffer");
nsSMState codingState;
for (PRUint32 i = 0; i < aLen; i++)

View File

@ -41,6 +41,7 @@
// 3, certain combination of kana is never used in japanese language
#include "nsGB2312Prober.h"
#include "nsDebug.h"
void nsGB18030Prober::Reset(void)
{
@ -52,6 +53,7 @@ void nsGB18030Prober::Reset(void)
nsProbingState nsGB18030Prober::HandleData(const char* aBuf, PRUint32 aLen)
{
NS_ASSERTION(aLen, "HandleData called with empty buffer");
nsSMState codingState;
for (PRUint32 i = 0; i < aLen; i++)

View File

@ -41,6 +41,7 @@
// 3, certain combination of kana is never used in japanese language
#include "nsSJISProber.h"
#include "nsDebug.h"
void nsSJISProber::Reset(void)
{
@ -52,6 +53,7 @@ void nsSJISProber::Reset(void)
nsProbingState nsSJISProber::HandleData(const char* aBuf, PRUint32 aLen)
{
NS_ASSERTION(aLen, "HandleData called with empty buffer");
nsSMState codingState;
for (PRUint32 i = 0; i < aLen; i++)

View File

@ -86,6 +86,7 @@ NS_IMETHODIMP nsXPCOMDetector::DoIt(const char* aBuf,
if((nsnull == aBuf) || (nsnull == oDontFeedMe))
return NS_ERROR_ILLEGAL_VALUE;
this->Reset();
nsresult rv = this->HandleData(aBuf, aLen);
if (NS_FAILED(rv))
return rv;