messageSchema.statics.getConversationWithObject = function (object, callback) {
  if (!_.isObject(object)) {
    return callback('Invalid Object (Must by of type Object) - MessageSchema.GetUserWithObject()', null)
  }

  const self = this
  let deletedAt = null

  const limit = object.limit === null ? 25 : object.limit
  const page = object.page === null ? 0 : object.page

  if (object.requestingUser) {
    const userMetaIdx = _.findIndex(object.userMeta, function (item) {
      return item.userId.toString() === object.requestingUser._id.toString()
    })
    if (userMetaIdx !== -1 && object.userMeta[userMetaIdx].deletedAt) {
      deletedAt = new Date(object.userMeta[userMetaIdx].deletedAt)
    }
  }

  const q = self
    .model(COLLECTION)
    .find({})
    .sort('-createdAt')
    .skip(page * limit)
    .populate({
      path: 'owner',
      select: '_id username fullname email image lastOnline'
    })

  if (limit !== -1) {
    q.limit(limit)
  }

  if (object.cid !== null) {
    q.where({ conversation: object.cid })
  }

  if (deletedAt) {
    q.where({ createdAt: { $gte: deletedAt } })
  }

  return q.exec(callback)
}
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.