[CoinUtils-tickets] [COIN-OR Common Utilities] #75: integer overflow in CoinArrayWithLength
COIN-OR Common Utilities
coin-trac at coin-or.org
Thu Jan 12 18:48:11 EST 2012
#75: integer overflow in CoinArrayWithLength
-------------------+---------------------
Reporter: mlubin | Type: defect
Status: new | Priority: critical
Version: | Keywords:
-------------------+---------------------
I am on a system with sizeof(int)==4, sizeof(long)==8 and sizeof(void*) ==
8. Although mallocArray and CoinArrayWithLength::conditionalNew take longs
as parameters, the size_ member of CoinArrayWithLength is an int, not a
long. All lengths in CoinArrayWithLength (and its descendants) should be
changed from int to intptr_t (stdint.h), which is a signed type that is
guaranteed to be large enough to store any memory address. I believe there
are architectures with sizeof(long)==4 and sizeof(void*)==8, so it is not
safe to change everything to long. I would suggest using intptr_t for
CoinBigIndex as well.
I traced a crash from clp when solving a large problem to this issue.
--
Ticket URL: <https://projects.coin-or.org/ticket/75>
COIN-OR Common Utilities <http://projects.coin-or.org/CoinUtils>
Common data structures and linear algebra functions for COIN-OR projects
More information about the CoinUtils-tickets
mailing list