Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: third_party/lcms2-2.6/0012-backport-c0a98d86.patch

Issue 2482523003: lcms: backport upstream commit c0a98d86 (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/lcms2-2.6/README.pdfium » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 diff --git a/third_party/lcms2-2.6/src/cmsintrp.c b/third_party/lcms2-2.6/src/cm sintrp.c
2 index 5d5f35d..14c6856 100644
3 --- a/third_party/lcms2-2.6/src/cmsintrp.c
4 +++ b/third_party/lcms2-2.6/src/cmsintrp.c
5 @@ -215,7 +215,7 @@ void LinLerp1D(register const cmsUInt16Number Value[],
6 // To prevent out of bounds indexing
7 cmsINLINE cmsFloat32Number fclamp(cmsFloat32Number v)
8 {
9 - return v < 0.0f ? 0.0f : (v > 1.0f ? 1.0f : v);
10 + return ((v < 0.0f) || isnan(v)) ? 0.0f : (v > 1.0f ? 1.0f : v);
11 }
12
13 // Floating-point version of 1D interpolation
14 diff --git a/third_party/lcms2-2.6/src/cmsio0.c b/third_party/lcms2-2.6/src/cmsi o0.c
15 index 5f9f08a..3ed730a 100644
16 --- a/third_party/lcms2-2.6/src/cmsio0.c
17 +++ b/third_party/lcms2-2.6/src/cmsio0.c
18 @@ -1475,6 +1475,17 @@ void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSi gnature sig)
19 // If the element is already in memory, return the pointer
20 if (Icc -> TagPtrs[n]) {
21
22 + if (Icc->TagTypeHandlers[n] == NULL) goto Error;
23 +
24 + // Sanity check
25 + BaseType = Icc->TagTypeHandlers[n]->Signature;
26 + if (BaseType == 0) goto Error;
27 +
28 + TagDescriptor = _cmsGetTagDescriptor(Icc->ContextID, sig);
29 + if (TagDescriptor == NULL) goto Error;
30 +
31 + if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error;
32 +
33 if (Icc ->TagSaveAsRaw[n]) goto Error; // We don't support read raw ta gs as cooked
34
35 _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
36 diff --git a/third_party/lcms2-2.6/src/cmstypes.c b/third_party/lcms2-2.6/src/cm stypes.c
37 index 04dd0c4..386439b 100644
38 --- a/third_party/lcms2-2.6/src/cmstypes.c
39 +++ b/third_party/lcms2-2.6/src/cmstypes.c
40 @@ -4297,8 +4297,12 @@ void *Type_MPEclut_Read(struct _cms_typehandler_struct* s elf, cmsIOHANDLER* io,
41
42 // Copy MAX_INPUT_DIMENSIONS at most. Expand to cmsUInt32Number
43 nMaxGrids = InputChans > MAX_INPUT_DIMENSIONS ? MAX_INPUT_DIMENSIONS : Inpu tChans;
44 - for (i=0; i < nMaxGrids; i++) GridPoints[i] = (cmsUInt32Number) Dimensions8 [i];
45
46 + for (i = 0; i < nMaxGrids; i++) {
47 + if (Dimensions8[i] == 1) goto Error; // Impossible value, 0 for no CLUT and then 2 at least
48 + GridPoints[i] = (cmsUInt32Number)Dimensions8[i];
49 + }
50 +
51 // Allocate the true CLUT
52 mpe = cmsStageAllocCLutFloatGranular(self ->ContextID, GridPoints, InputCha ns, OutputChans, NULL);
53 if (mpe == NULL) goto Error;
OLDNEW
« no previous file with comments | « no previous file | third_party/lcms2-2.6/README.pdfium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698