提交 3c0674e7 编写于 作者: A aph

6839133: lcms 1.18 update breaks ICC_ProfileRGB Tests

Reviewed-by: avu, prr
上级 310dd2d9
...@@ -610,14 +610,19 @@ LCMSBOOL _cmsModifyTagData(cmsHPROFILE hProfile, icTagSignature sig, ...@@ -610,14 +610,19 @@ LCMSBOOL _cmsModifyTagData(cmsHPROFILE hProfile, icTagSignature sig,
return FALSE; return FALSE;
} }
if (!Icc->Grow(Icc, delta)) { /* We change the size of Icc here only if we know it'll actually
free(ptr); * grow: if Icc is about to shrink we must wait until we've read
if(isNew) { * the previous data. */
Icc->TagCount--; if (delta > 0) {
if (!Icc->Grow(Icc, delta)) {
free(ptr);
if(isNew) {
Icc->TagCount--;
}
J2dRlsTraceLn(J2D_TRACE_ERROR,
"_cmsModifyTagData: Icc->Grow() == FALSE");
return FALSE;
} }
J2dRlsTraceLn(J2D_TRACE_ERROR,
"_cmsModifyTagData: Icc->Grow() == FALSE");
return FALSE;
} }
/* Compute size of tag data before/after the modified tag */ /* Compute size of tag data before/after the modified tag */
...@@ -680,6 +685,18 @@ LCMSBOOL _cmsModifyTagData(cmsHPROFILE hProfile, icTagSignature sig, ...@@ -680,6 +685,18 @@ LCMSBOOL _cmsModifyTagData(cmsHPROFILE hProfile, icTagSignature sig,
temp = TransportValue32(profileSize); temp = TransportValue32(profileSize);
Icc->Write(Icc, sizeof(icUInt32Number), &temp); Icc->Write(Icc, sizeof(icUInt32Number), &temp);
/* Shrink Icc, if needed. */
if (delta < 0) {
if (!Icc->Grow(Icc, delta)) {
free(ptr);
if(isNew) {
Icc->TagCount--;
}
J2dRlsTraceLn(J2D_TRACE_ERROR,
"_cmsModifyTagData: Icc->Grow() == FALSE");
return FALSE;
}
}
/* Adjust tag offsets: if the tag is new, we must account /* Adjust tag offsets: if the tag is new, we must account
for the new tag table entry; otherwise, only those tags after for the new tag table entry; otherwise, only those tags after
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册