Bug 853536 - Never write to size-only decoders when we've already gotten the size. r=jrmuizel

--HG--
extra : rebase_source : 14e8cf30dc665eab10e04ef643513bcfad633ea2
This commit is contained in:
Joe Drew 2013-03-23 11:05:55 -04:00
parent a679f9774a
commit 60c742750a
3 changed files with 5 additions and 10 deletions

View File

@ -213,11 +213,6 @@ nsICODecoder::WriteInternal(const char* aBuffer, uint32_t aCount)
{
NS_ABORT_IF_FALSE(!HasError(), "Shouldn't call WriteInternal after error!");
if (IsSizeDecode() && HasSize()) {
// More data came in since we found the size. We have nothing to do here.
return;
}
if (!aCount) {
if (mContainedDecoder) {
WriteToContainedDecoder(aBuffer, aCount);

View File

@ -194,11 +194,6 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, uint32_t aCount)
NS_ABORT_IF_FALSE(!HasError(), "Shouldn't call WriteInternal after error!");
if (IsSizeDecode() && HasSize()) {
// More data came in since we found the size. We have nothing to do here.
return;
}
/* Return here if there is a fatal error within libjpeg. */
nsresult error_code;
// This cast to nsresult makes sense because setjmp() returns whatever we

View File

@ -97,6 +97,11 @@ Decoder::Write(const char* aBuffer, uint32_t aCount)
if (HasDataError())
return;
if (IsSizeDecode() && HasSize()) {
// More data came in since we found the size. We have nothing to do here.
return;
}
// Pass the data along to the implementation
WriteInternal(aBuffer, aCount);