-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
BugBug ReportBug ReportChanges RequestedMaintainer Request for ChangesMaintainer Request for ChangesProposalPropose changes to the Community & MaintainersPropose changes to the Community & MaintainersSecuritySecurity RelatedSecurity RelatedTriagedMaintainer indicates triaged status and ready for developer handoffMaintainer indicates triaged status and ready for developer handoffcpp-source
Description
Issue Summary
Wed Jan 21 11:33:42 PM UTC 2026
Proposed: Refactor C-style downcasts leading to UB, TC & NPD in IccXML
UB unsafe casts in IccXML can be identified using:
grep -rn '([[:space:]]*CIcc[^)]*Xml[[:space:]]*\*[[:space:]]*)' IccXML/ --include="*.cpp" | grep -v "new CIcc" | grep -v "//"
References
#499
#527
https://github.com/InternationalColorConsortium/iccDEV/issues?q=is%3Aissue%20state%3Aclosed%20downcast
Target Files
IccXML/IccLibXML/IccProfileXml.cpp:225: CIccTagXml *pTagXml = (CIccTagXml*)(pTag->GetExtension());
IccXML/IccLibXML/IccProfileXml.cpp:695: CIccTagXml* pXmlTag = (CIccTagXml*)pExt;
IccXML/IccLibXML/IccProfileXml.cpp:749: CIccTagXml* pXmlTag = (CIccTagXml*)pExt;
IccXML/IccLibXML/IccTagXml.cpp:2235: pExt = (CIccTagXml*)(pTag->GetExtension());
IccXML/IccLibXML/IccTagXml.cpp:2258: pExt = (CIccTagXml*)(pTag->GetExtension());
IccXML/IccLibXML/IccTagXml.cpp:2320: CIccTagXml *pExt = (CIccTagXml*)(pTag->GetExtension());
IccXML/IccLibXML/IccTagXml.cpp:2346: CIccTagXml *pExt = (CIccTagXml*)(pTag->GetExtension());
IccXML/IccLibXML/IccTagXml.cpp:3082: if (!((CIccCurveXml *)pTag)->ToXml(xml, nType, blanks + " "))
IccXML/IccLibXML/IccTagXml.cpp:3094: return ((CIccSegmentedCurveXml*)m_pCurve)->ToXml(xml, blanks);
IccXML/IccLibXML/IccTagXml.cpp:3288: CIccCurveXml *pCurveXml = (CIccCurveXml *)pExt;
IccXML/IccLibXML/IccTagXml.cpp:3305: CIccTagXml *pXmlTag = (CIccTagXml *)pExt;
IccXML/IccLibXML/IccTagXml.cpp:4000: CIccMpeXml *pMpeXml = (CIccMpeXml*)pMpeExt;
IccXML/IccLibXML/IccTagXml.cpp:4099: CIccMpeXml* pXmlMpe = (CIccMpeXml*)pExt;
IccXML/IccLibXML/IccTagXml.cpp:4438: CIccTagXml *pTagXml = (CIccTagXml*)(pTag->GetExtension());
IccXML/IccLibXML/IccTagXml.cpp:4633: CIccTagXml* pXmlTag = (CIccTagXml*)pExt;
IccXML/IccLibXML/IccTagXml.cpp:4677: CIccTagXml* pXmlTag = (CIccTagXml*)pExt;
IccXML/IccLibXML/IccTagXml.cpp:4805: CIccTagXml *pTagXml = (CIccTagXml*)(pTag->GetExtension());
IccXML/IccLibXML/IccTagXml.cpp:4915: CIccTagXml* pXmlTag = (CIccTagXml*)pExt;
IccXML/IccLibXML/IccTagXml.cpp:5140: CIccProfileXml *pProfile = (CIccProfileXml*)m_pProfile;
IccXML/IccLibXML/IccMpeXml.cpp:1573: CIccTagXml *pTagXml = (CIccTagXml*)pTagEx;
IccXML/IccLibXML/IccMpeXml.cpp:1632: CIccTagXml* pXmlTag = (CIccTagXml*)pExt;
IccXML/IccLibXML/IccMpeXml.cpp:2321: CIccMpeXml *pMpe = (CIccMpeXml*)pExt;
IccXML/IccLibXML/IccMpeXml.cpp:2614: CIccMpeXml* pXmlMpe = (CIccMpeXml*)pExt;
Takeaway
These unsafe cast all bypass compiler checks currently leading to TC, UB & NPD.
- Request is to consider Refactoring when time permits
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugBug ReportBug ReportChanges RequestedMaintainer Request for ChangesMaintainer Request for ChangesProposalPropose changes to the Community & MaintainersPropose changes to the Community & MaintainersSecuritySecurity RelatedSecurity RelatedTriagedMaintainer indicates triaged status and ready for developer handoffMaintainer indicates triaged status and ready for developer handoffcpp-source