IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40015


Ignore:
Timestamp:
Apr 13, 2017, 6:34:26 AM (9 years ago)
Author:
eugene
Message:

avoid numerical errors when testing the limits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/create.c

    r39599 r40015  
    4040  }
    4141
     42  // make a 1gig hard limit (test as below to avoid numerical limits of the division)
     43  // 0x4000.0000 bytes is a gigabyte, divide by 8 for bytes/element
     44  if (0x8000000 * delta < end - start) {
     45    gprint (GP_ERR, "ERROR: attempt to create >1gigabyte vector\n");
     46    return (FALSE);
     47  }
    4248  vec[0].Nelements = MAX(0, (end - start) / delta);
    4349
Note: See TracChangeset for help on using the changeset viewer.