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/lcms2_DLL/lcms2_DLL.vcxproj b/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj
23 index 4c8aa3f..d1bf3eb 100644
24 --- a/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj
25 +++ b/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj
27 <ProjectGuid>{8C51BE48-ADB8-4089-A9EC-F6BF993A0548}</ProjectGuid>
28 <RootNamespace>lcms2_DLL</RootNamespace>
29 <Keyword>Win32Proj</Keyword>
30 - <WindowsTargetPlatformVersion>8.1</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_static/lcms2_static.vcxproj b/Projects/VC2017/lcms2_static/lcms2_static.vcxproj
35 index 2a9988a..9fc05ce 100644
36 --- a/Projects/VC2017/lcms2_static/lcms2_static.vcxproj
37 +++ b/Projects/VC2017/lcms2_static/lcms2_static.vcxproj
39 <ProjectGuid>{71DEDE59-3F1E-486B-A899-4283000F76B5}</ProjectGuid>
40 <RootNamespace>lcms2_static</RootNamespace>
41 <Keyword>Win32Proj</Keyword>
42 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
44 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
45 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
46 diff --git a/Projects/VC2017/linkicc/linkicc.vcxproj b/Projects/VC2017/linkicc/linkicc.vcxproj
47 index 30c2b4e..51586dd 100644
48 --- a/Projects/VC2017/linkicc/linkicc.vcxproj
49 +++ b/Projects/VC2017/linkicc/linkicc.vcxproj
51 <ProjectGuid>{FBFBE1DC-DB84-4BA1-9552-B4780F457849}</ProjectGuid>
52 <RootNamespace>linkicc</RootNamespace>
53 <Keyword>Win32Proj</Keyword>
54 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
56 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
57 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
58 diff --git a/Projects/VC2017/psicc/psicc.vcxproj b/Projects/VC2017/psicc/psicc.vcxproj
59 index 9dcf89a..8f26e12 100644
60 --- a/Projects/VC2017/psicc/psicc.vcxproj
61 +++ b/Projects/VC2017/psicc/psicc.vcxproj
63 <ProjectGuid>{EF6A8851-65FE-46F5-B9EF-14F0B671F693}</ProjectGuid>
64 <RootNamespace>psicc</RootNamespace>
65 <Keyword>Win32Proj</Keyword>
66 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
68 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
69 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
70 diff --git a/Projects/VC2017/testbed/testbed.vcxproj b/Projects/VC2017/testbed/testbed.vcxproj
71 index 0af3762..3f6aea3 100644
72 --- a/Projects/VC2017/testbed/testbed.vcxproj
73 +++ b/Projects/VC2017/testbed/testbed.vcxproj
75 <ProjectGuid>{928A3A2B-46EF-4279-959C-513B3652FF0E}</ProjectGuid>
76 <RootNamespace>testbed</RootNamespace>
77 <Keyword>Win32Proj</Keyword>
78 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
80 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
81 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
82 diff --git a/Projects/VC2017/tiffdiff/tiffdiff.vcxproj b/Projects/VC2017/tiffdiff/tiffdiff.vcxproj
83 index 7edfe28..3a6d837 100644
84 --- a/Projects/VC2017/tiffdiff/tiffdiff.vcxproj
85 +++ b/Projects/VC2017/tiffdiff/tiffdiff.vcxproj
87 <ProjectGuid>{75B91835-CCD7-48BE-A606-A9C997D5DBEE}</ProjectGuid>
88 <RootNamespace>tiffdiff</RootNamespace>
89 <Keyword>Win32Proj</Keyword>
90 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
92 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
93 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
94 diff --git a/Projects/VC2017/tifficc/tifficc.vcxproj b/Projects/VC2017/tifficc/tifficc.vcxproj
95 index cd9f04c..5ef954f 100644
96 --- a/Projects/VC2017/tifficc/tifficc.vcxproj
97 +++ b/Projects/VC2017/tifficc/tifficc.vcxproj
99 <ProjectGuid>{2256DE16-ED92-4A6F-9C54-F65BB61E64A2}</ProjectGuid>
100 <RootNamespace>tifficc</RootNamespace>
101 <Keyword>Win32Proj</Keyword>
102 - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
104 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
105 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
106 diff --git a/src/cmscgats.c b/src/cmscgats.c
107 index 1a87613..8c3e96d 100644
111 //---------------------------------------------------------------------------------
113 // Little Color Management System
114 -// Copyright (c) 1998-2017 Marti Maria Saguer
115 +// Copyright (c) 1998-2018 Marti Maria Saguer
117 // Permission is hereby granted, free of charge, to any person obtaining
118 // a copy of this software and associated documentation files (the "Software"),
119 @@ -1506,10 +1506,16 @@ void AllocateDataSet(cmsIT8* it8)
120 t-> nSamples = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_FIELDS"));
121 t-> nPatches = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_SETS"));
123 - t-> Data = (char**)AllocChunk (it8, ((cmsUInt32Number) t->nSamples + 1) * ((cmsUInt32Number) t->nPatches + 1) *sizeof (char*));
124 - if (t->Data == NULL) {
125 + if (t -> nSamples < 0 || t->nSamples > 0x7ffe || t->nPatches < 0 || t->nPatches > 0x7ffe)
127 + SynError(it8, "AllocateDataSet: too much data");
130 + t->Data = (char**)AllocChunk(it8, ((cmsUInt32Number)t->nSamples + 1) * ((cmsUInt32Number)t->nPatches + 1) * sizeof(char*));
131 + if (t->Data == NULL) {
133 - SynError(it8, "AllocateDataSet: Unable to allocate data array");
134 + SynError(it8, "AllocateDataSet: Unable to allocate data array");