message: Large ref tweaks
diff: @@ -214,7 +214,7 @@ GroupWriter::GroupWriter(Group& group)
  }
  else {
  int_fast64_t value = int_fast64_t(initial_version); // FIXME: Problematic unsigned -> signed conversion
  - top.set(6, 1 + 2 * uint64_t(value)); // Throws
  + top.set(6, 1 + 2 * uint64_t(initial_version)); // Throws
  size_t n = m_free_positions.size();
  bool context_flag = false;
  m_free_versions.Array::create(Array::type_Normal, context_flag, n, value); // Throws
  @@ -687,7 +687,11 @@ std::pair<size_t, size_t> GroupWriter::extend_free_space(size_t requested_size)
  // extended the file size. It can also happen as part of initial file expansion
  // during attach_file().
  size_t logical_file_size = to_size_t(m_group.m_top.get(2) / 2);
  - size_t new_file_size = logical_file_size + requested_size;
  + size_t new_file_size = logical_file_size;
  + if (REALM_UNLIKELY(int_add_with_overflow_detect(new_file_size, requested_size))) {
  + throw MaximumFileSizeExceeded("GroupWriter cannot extend free space: " + util::to_string(logical_file_size)
  + + " + " + util::to_string(requested_size));
  + }
  if (!alloc.matches_section_boundary(new_file_size)) {
  new_file_size = alloc.get_upper_section_boundary(new_file_size);
  