message: mstarch: validating file size parameters for
diff: @@ -160,8 +160,15 @@ namespace Os {
  // make sure it has been opened
  if (OPEN_NO_MODE == this->m_mode) {
  + size = 0;
  return NOT_OPENED;
  }
  + // Validate read size before entering reading loop. Linux's read call expects size_t, which
  + // is defined as an unsigned value. Thus 0 and negative values rejected.
  + if (size <= 0) {
  + size = 0;
  + return BAD_SIZE;
  + }
  NATIVE_INT_TYPE accSize = 0; // accumulated size
  @@ -232,6 +239,12 @@ namespace Os {
  size = 0;
  return NOT_OPENED;
  }
  + // Validate read size before entering reading loop. Linux's read call expects size_t, which
  + // is defined as an unsigned value. Thus 0 and negative values rejected.
  + if (size <= 0) {
  + size = 0;
  + return BAD_SIZE;
  + }
  Status stat = OP_OK;
  // just check for EINTR
  @@ -291,6 +304,16 @@ namespace Os {
  totalSize = 0;
  return NOT_OPENED;
  }
  + // Validate read size before entering reading loop. Linux's read call expects size_t, which
  + // is defined as an unsigned value. Thus 0 and negative values rejected.
  + if (totalSize == 0) {
  + totalSize = 0;
  + return BAD_SIZE;
  + }
  + else if (chunkSize <= 0) {
  + totalSize = 0;
  + return BAD_SIZE;
  + }
  #ifdef __linux__
  const NATIVE_UINT_TYPE startPosition = lseek(this->m_fd, 0, SEEK_CUR);
  