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

Side by Side Diff: third_party/lcms2-2.6/0002-infinite-loop-GrowNamedColorList.patch

Issue 2365663002: Fix infinite loop when calling GrowNamedColorList (Closed)
Patch Set: Created 4 years, 2 months 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/cmsnamed.c b/third_party/lcms2-2.6/src/cm snamed.c
2 index acfd1c8..ef1eb30 100644
3 --- a/third_party/lcms2-2.6/src/cmsnamed.c
4 +++ b/third_party/lcms2-2.6/src/cmsnamed.c
5 @@ -514,8 +514,12 @@ cmsNAMEDCOLORLIST* CMSEXPORT cmsAllocNamedColorList(cmsCont ext ContextID, cmsUIn
6 v ->nColors = 0;
7 v ->ContextID = ContextID;
8
9 - while (v -> Allocated < n)
10 - GrowNamedColorList(v);
11 + while (v -> Allocated < n) {
12 + if (!GrowNamedColorList(v)) {
13 + cmsFreeNamedColorList(v);
14 + return NULL;
15 + }
16 + }
17
18 strncpy(v ->Prefix, Prefix, sizeof(v ->Prefix)-1);
19 strncpy(v ->Suffix, Suffix, sizeof(v ->Suffix)-1);
20 @@ -544,8 +548,12 @@ cmsNAMEDCOLORLIST* CMSEXPORT cmsDupNamedColorList(const cms NAMEDCOLORLIST* v)
21 if (NewNC == NULL) return NULL;
22
23 // For really large tables we need this
24 - while (NewNC ->Allocated < v ->Allocated)
25 - GrowNamedColorList(NewNC);
26 + while (NewNC ->Allocated < v ->Allocated) {
27 + if (!GrowNamedColorList(NewNC)) {
28 + cmsFreeNamedColorList(NewNC);
29 + return NULL;
30 + }
31 + }
32
33 memmove(NewNC ->Prefix, v ->Prefix, sizeof(v ->Prefix));
34 memmove(NewNC ->Suffix, v ->Suffix, sizeof(v ->Suffix));
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