CNA-BUG-075: Point declares +, -, * and / operators that XNA 4.0's Point does not have, without the CNAEXT marker, and / has no divide-by-zero guard
Evidence basis: source-verified at the pinned commit; tests exist (not executed for this page). Claims on this page were checked by reading the CNA source at commit 009d40f5; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.
CNA_STRICT_XNA_API cannot flag these extensions because they are not marked CNAEXT, and Point / Point with a zero component is an integer division by zero.
- Identifier
CNA-BUG-075- Category
- Bug
- Subsystem
- Math & geometry
- Status
- Open
- Verified against
- CNA
009d40f5(009d40f5dd085c4e674d3479675fac84b12b3e0a) - Severity
- Low (a triage suggestion, not a project priority)
- Evidence basis
- Source-verified: read at TARGET, not executed
- Tests touching this area
- Yes: see Current tests
- Affected contract
- Microsoft::Xna::Framework::Point operator+, operator-, operator*, operator/
Expected behaviour
XNA 4.0's Point has only == and !=. CNA's convention is that API beyond XNA carries the CNAEXT marker so that a CNA_STRICT_XNA_API build can flag it.
Actual behaviour at TARGET
Point.hpp declares the four arithmetic operators as unmarked friends; Point.cpp's operator/ divides the int components directly, so a zero divisor is undefined behaviour (typically a hardware trap).
Source locations
modules/math/include/Microsoft/Xna/Framework/Point.hpp— operator+, operator-, operator*, operator/ declarations without CNAEXTmodules/math/src/Point.cpp— operator/ implementation
Evidence
Checked by reading the named sources at 009d40f5; nothing was built or executed for this entry.
Focused reproduction
No focused reproduction is known. Nothing has been invented here; the evidence above is what exists.
Current tests
PointTests.cpp exercises the operators but not a zero divisor, and no strict-API check lists them.
Regression test
Mark the operators CNAEXT (and add them to the strict-API check), and decide and test the zero-divisor behaviour.
Blast radius
Code written against CNA that relies on these operators will not compile against XNA; a zero divisor crashes.
Workaround
No workaround is known.
Related pages
The same subject is explained at several altitudes. These are the neighbouring pages at each one.
- Deep dives
- Rectangle, Point and Color: Point · CNAEXT catalog
- Known issues
- Bug index