@@ -1111,6 +1111,8 @@ void *Type_Text_Description_Read(struct _cms_typehandler_struct* self, cmsIOHAND
1111
1111
1112
1112
// Read len of ASCII
1113
1113
if (!_cmsReadUInt32Number (io , & AsciiCount )) return NULL ;
1114
+ if (AsciiCount > 0x7ffff ) return NULL ;
1115
+
1114
1116
SizeOfTag -= sizeof (cmsUInt32Number );
1115
1117
1116
1118
// Check for size
@@ -1141,8 +1143,9 @@ void *Type_Text_Description_Read(struct _cms_typehandler_struct* self, cmsIOHAND
1141
1143
if (!_cmsReadUInt32Number (io , & UnicodeCode )) goto Done ;
1142
1144
if (!_cmsReadUInt32Number (io , & UnicodeCount )) goto Done ;
1143
1145
SizeOfTag -= 2 * sizeof (cmsUInt32Number );
1144
-
1145
- if (UnicodeCount == 0 || SizeOfTag < UnicodeCount * sizeof (cmsUInt16Number )) goto Done ;
1146
+
1147
+ if (UnicodeCount == 0 || UnicodeCount > 0x7ffff ||
1148
+ SizeOfTag < UnicodeCount * sizeof (cmsUInt16Number )) goto Done ;
1146
1149
1147
1150
UnicodeString = (wchar_t * )_cmsMallocZero (self -> ContextID , (UnicodeCount + 1 ) * sizeof (wchar_t ));
1148
1151
if (UnicodeString == NULL ) goto Done ;
@@ -5334,7 +5337,7 @@ cmsBool ReadOneWChar(cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, wchar
5334
5337
if (!io -> Seek (io , e -> Offsets [i ])) return FALSE;
5335
5338
5336
5339
nChars = e -> Sizes [i ] / sizeof (cmsUInt16Number );
5337
-
5340
+ if ( nChars > 0x7ffff ) return FALSE;
5338
5341
5339
5342
* wcstr = (wchar_t * ) _cmsMallocZero (e -> ContextID , (nChars + 1 ) * sizeof (wchar_t ));
5340
5343
if (* wcstr == NULL ) return FALSE;
0 commit comments