Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 521292 Details for
Bug 642902
[patch]
don't crash if we have a profile
952373d0334e (text/plain), 2.31 KB, created by
Joe Drew (not getting mail)
(
hide
)
Description:
don't crash if we have a profile
Filename:
MIME Type:
Creator:
Joe Drew (not getting mail)
Size:
2.31 KB
patch
obsolete
> ># HG changeset patch ># User Joe Drew <joe@drew.ca> ># Date 1300897243 14400 ># Node ID 952373d0334eb7fda761843cc59c7e850733939f ># Parent 7ed3b1c14e926682d424f33d67340dbe6ab70222 >Bug 642902 - If a profile's invalid, we leak it. Don't. r=jrmuizel > >diff --git a/modules/libpr0n/decoders/nsJPEGDecoder.cpp b/modules/libpr0n/decoders/nsJPEGDecoder.cpp >--- a/modules/libpr0n/decoders/nsJPEGDecoder.cpp >+++ b/modules/libpr0n/decoders/nsJPEGDecoder.cpp >@@ -79,16 +79,30 @@ namespace imagelib { > #if defined(PR_LOGGING) > PRLogModuleInfo *gJPEGlog = PR_NewLogModule("JPEGDecoder"); > static PRLogModuleInfo *gJPEGDecoderAccountingLog = PR_NewLogModule("JPEGDecoderAccounting"); > #else > #define gJPEGlog > #define gJPEGDecoderAccountingLog > #endif > >+static qcms_profile* >+GetICCProfile(struct jpeg_decompress_struct &info) >+{ >+ JOCTET* profilebuf; >+ PRUint32 profileLength; >+ qcms_profile* profile = nsnull; >+ >+ if (read_icc_profile(&info, &profilebuf, &profileLength)) { >+ profile = qcms_profile_from_memory(profilebuf, profileLength); >+ free(profilebuf); >+ } >+ >+ return profile; >+} > > METHODDEF(void) init_source (j_decompress_ptr jd); > METHODDEF(boolean) fill_input_buffer (j_decompress_ptr jd); > METHODDEF(void) skip_input_data (j_decompress_ptr jd, long num_bytes); > METHODDEF(void) term_source (j_decompress_ptr jd); > METHODDEF(void) my_error_exit (j_common_ptr cinfo); > > /* Normal JFIF markers can't have more bytes than this. */ >@@ -243,24 +257,18 @@ nsJPEGDecoder::WriteInternal(const char > // Post our size to the superclass > PostSize(mInfo.image_width, mInfo.image_height); > > /* If we're doing a size decode, we're done. */ > if (IsSizeDecode()) > return; > > /* We're doing a full decode. */ >- JOCTET *profile; >- PRUint32 profileLength; >- >- if ((mCMSMode != eCMSMode_Off) && >- read_icc_profile(&mInfo, &profile, &profileLength) && >- (mInProfile = qcms_profile_from_memory(profile, profileLength)) != NULL) { >- free(profile); >- >+ if (mCMSMode != eCMSMode_Off && >+ (mInProfile = GetICCProfile(mInfo)) != nsnull) { > PRUint32 profileSpace = qcms_profile_get_color_space(mInProfile); > PRBool mismatch = PR_FALSE; > > #ifdef DEBUG_tor > fprintf(stderr, "JPEG profileSpace: 0x%08X\n", profileSpace); > #endif > switch (mInfo.jpeg_color_space) { > case JCS_GRAYSCALE:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Flags:
jrmuizel
: review+
Actions:
View
|
Diff
|
Review
Attachments on
bug 642902
:
520252
|
520312
|
520313
|
520315
|
520319
|
520320
|
521291
| 521292