1 From 768f70ca405cd3159d990e962d54456773bb8cf8 Mon Sep 17 00:00:00 2001
2 From: Marti Maria <info@littlecms.com>
3 Date: Wed, 15 Aug 2018 20:07:56 +0200
4 Subject: [PATCH 17/18] Upgrade Visual studio 2017 15.8
7 - Add check on CGATS memory allocation (thanks to Quang Nguyen for
10 Projects/VC2017/jpegicc/jpegicc.vcxproj | 1 +
11 Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj | 2 +-
12 Projects/VC2017/lcms2_static/lcms2_static.vcxproj | 2 +-
13 Projects/VC2017/linkicc/linkicc.vcxproj | 2 +-
14 Projects/VC2017/psicc/psicc.vcxproj | 2 +-
15 Projects/VC2017/testbed/testbed.vcxproj | 2 +-
16 Projects/VC2017/tiffdiff/tiffdiff.vcxproj | 2 +-
17 Projects/VC2017/tifficc/tifficc.vcxproj | 2 +-
18 Projects/VC2017/transicc/transicc.vcxproj | 1 +
19 src/cmscgats.c | 14 ++++++++++----
20 10 files changed, 19 insertions(+), 11 deletions(-)
22 diff --git a/Projects/VC2017/jpegicc/jpegicc.vcxproj b/Projects/VC2017/jpegicc/jpegicc.vcxproj
23 index ab26a53..39cfd00 100644
24 --- a/Projects/VC2017/jpegicc/jpegicc.vcxproj
25 +++ b/Projects/VC2017/jpegicc/jpegicc.vcxproj
27 <ProjectGuid>{62812507-F926-4968-96A9-17678460AD90}</ProjectGuid>
28 <RootNamespace>jpegicc</RootNamespace>
29 <Keyword>Win32Proj</Keyword>
30 + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
32 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
33 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
34 diff --git a/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj b/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj
35 index 4c8aa3f..d1bf3eb 100644
36 --- a/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj
37 +++ b/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj
39 <ProjectGuid>{8C51BE48-ADB8-4089-A9EC-F6BF993A0548}</ProjectGuid>
40 <RootNamespace>lcms2_DLL</RootNamespace>
41 <Keyword>Win32Proj</Keyword>
42 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
43 + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
45 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
46 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
47 diff --git a/Projects/VC2017/lcms2_static/lcms2_static.vcxproj b/Projects/VC2017/lcms2_static/lcms2_static.vcxproj
48 index 2a9988a..9fc05ce 100644
49 --- a/Projects/VC2017/lcms2_static/lcms2_static.vcxproj
50 +++ b/Projects/VC2017/lcms2_static/lcms2_static.vcxproj
52 <ProjectGuid>{71DEDE59-3F1E-486B-A899-4283000F76B5}</ProjectGuid>
53 <RootNamespace>lcms2_static</RootNamespace>
54 <Keyword>Win32Proj</Keyword>
55 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
56 + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
58 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
59 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
60 diff --git a/Projects/VC2017/linkicc/linkicc.vcxproj b/Projects/VC2017/linkicc/linkicc.vcxproj
61 index 30c2b4e..51586dd 100644
62 --- a/Projects/VC2017/linkicc/linkicc.vcxproj
63 +++ b/Projects/VC2017/linkicc/linkicc.vcxproj
65 <ProjectGuid>{FBFBE1DC-DB84-4BA1-9552-B4780F457849}</ProjectGuid>
66 <RootNamespace>linkicc</RootNamespace>
67 <Keyword>Win32Proj</Keyword>
68 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
69 + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
71 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
72 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
73 diff --git a/Projects/VC2017/psicc/psicc.vcxproj b/Projects/VC2017/psicc/psicc.vcxproj
74 index 9dcf89a..8f26e12 100644
75 --- a/Projects/VC2017/psicc/psicc.vcxproj
76 +++ b/Projects/VC2017/psicc/psicc.vcxproj
78 <ProjectGuid>{EF6A8851-65FE-46F5-B9EF-14F0B671F693}</ProjectGuid>
79 <RootNamespace>psicc</RootNamespace>
80 <Keyword>Win32Proj</Keyword>
81 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
82 + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
84 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
85 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
86 diff --git a/Projects/VC2017/testbed/testbed.vcxproj b/Projects/VC2017/testbed/testbed.vcxproj
87 index 0af3762..3f6aea3 100644
88 --- a/Projects/VC2017/testbed/testbed.vcxproj
89 +++ b/Projects/VC2017/testbed/testbed.vcxproj
91 <ProjectGuid>{928A3A2B-46EF-4279-959C-513B3652FF0E}</ProjectGuid>
92 <RootNamespace>testbed</RootNamespace>
93 <Keyword>Win32Proj</Keyword>
94 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
95 + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
97 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
98 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
99 diff --git a/Projects/VC2017/tiffdiff/tiffdiff.vcxproj b/Projects/VC2017/tiffdiff/tiffdiff.vcxproj
100 index 7edfe28..3a6d837 100644
101 --- a/Projects/VC2017/tiffdiff/tiffdiff.vcxproj
102 +++ b/Projects/VC2017/tiffdiff/tiffdiff.vcxproj
104 <ProjectGuid>{75B91835-CCD7-48BE-A606-A9C997D5DBEE}</ProjectGuid>
105 <RootNamespace>tiffdiff</RootNamespace>
106 <Keyword>Win32Proj</Keyword>
107 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
108 + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
110 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
111 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
112 diff --git a/Projects/VC2017/tifficc/tifficc.vcxproj b/Projects/VC2017/tifficc/tifficc.vcxproj
113 index cd9f04c..5ef954f 100644
114 --- a/Projects/VC2017/tifficc/tifficc.vcxproj
115 +++ b/Projects/VC2017/tifficc/tifficc.vcxproj
117 <ProjectGuid>{2256DE16-ED92-4A6F-9C54-F65BB61E64A2}</ProjectGuid>
118 <RootNamespace>tifficc</RootNamespace>
119 <Keyword>Win32Proj</Keyword>
120 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
121 + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
123 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
124 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
125 diff --git a/Projects/VC2017/transicc/transicc.vcxproj b/Projects/VC2017/transicc/transicc.vcxproj
126 index d9b77c6..b3173d8 100644
127 --- a/Projects/VC2017/transicc/transicc.vcxproj
128 +++ b/Projects/VC2017/transicc/transicc.vcxproj
130 <ProjectGuid>{9EE22D66-C849-474C-9ED5-C3E141DAB160}</ProjectGuid>
131 <RootNamespace>transicc</RootNamespace>
132 <Keyword>Win32Proj</Keyword>
133 + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
135 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
136 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
137 diff --git a/src/cmscgats.c b/src/cmscgats.c
138 index 1a87613..8c3e96d 100644
142 //---------------------------------------------------------------------------------
144 // Little Color Management System
145 -// Copyright (c) 1998-2017 Marti Maria Saguer
146 +// Copyright (c) 1998-2018 Marti Maria Saguer
148 // Permission is hereby granted, free of charge, to any person obtaining
149 // a copy of this software and associated documentation files (the "Software"),
150 @@ -1506,10 +1506,16 @@ void AllocateDataSet(cmsIT8* it8)
151 t-> nSamples = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_FIELDS"));
152 t-> nPatches = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_SETS"));
154 - t-> Data = (char**)AllocChunk (it8, ((cmsUInt32Number) t->nSamples + 1) * ((cmsUInt32Number) t->nPatches + 1) *sizeof (char*));
155 - if (t->Data == NULL) {
156 + if (t -> nSamples < 0 || t->nSamples > 0x7ffe || t->nPatches < 0 || t->nPatches > 0x7ffe)
158 + SynError(it8, "AllocateDataSet: too much data");
161 + t->Data = (char**)AllocChunk(it8, ((cmsUInt32Number)t->nSamples + 1) * ((cmsUInt32Number)t->nPatches + 1) * sizeof(char*));
162 + if (t->Data == NULL) {
164 - SynError(it8, "AllocateDataSet: Unable to allocate data array");
165 + SynError(it8, "AllocateDataSet: Unable to allocate data array");