summaryrefslogtreecommitdiff
path: root/third_party/lcms2-2.6/src/cmsio0.c
diff options
context:
space:
mode:
authorkcwu <kcwu@chromium.org>2016-11-07 10:41:52 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-07 10:41:52 -0800
commit413e3518ce390860cb5560720e5fba3ca7c8f764 (patch)
treeab0fba43e66f7b5bb174eb93b959e9c54d20fbb0 /third_party/lcms2-2.6/src/cmsio0.c
parenteb3f68cc7f25a1e28464eb251161b8f08fcd04bc (diff)
downloadpdfium-413e3518ce390860cb5560720e5fba3ca7c8f764.tar.xz
lcms: backport upstream commit c0a98d86
This fixed several issues. BUG=chromium:654265,chromium:657282,chromium:654676,chromium:654313 Review-Url: https://codereview.chromium.org/2482523003
Diffstat (limited to 'third_party/lcms2-2.6/src/cmsio0.c')
-rw-r--r--third_party/lcms2-2.6/src/cmsio0.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/third_party/lcms2-2.6/src/cmsio0.c b/third_party/lcms2-2.6/src/cmsio0.c
index 5f9f08a6f8..3ed730a92a 100644
--- a/third_party/lcms2-2.6/src/cmsio0.c
+++ b/third_party/lcms2-2.6/src/cmsio0.c
@@ -1475,6 +1475,17 @@ void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig)
// If the element is already in memory, return the pointer
if (Icc -> TagPtrs[n]) {
+ if (Icc->TagTypeHandlers[n] == NULL) goto Error;
+
+ // Sanity check
+ BaseType = Icc->TagTypeHandlers[n]->Signature;
+ if (BaseType == 0) goto Error;
+
+ TagDescriptor = _cmsGetTagDescriptor(Icc->ContextID, sig);
+ if (TagDescriptor == NULL) goto Error;
+
+ if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error;
+
if (Icc ->TagSaveAsRaw[n]) goto Error; // We don't support read raw tags as cooked
_cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);