)]}'
{
  "commit": "7768e5d7dc26cda185a037c75fc6f242273e7bce",
  "tree": "50c27048b457caa3f29cae6fc4a8d5cf7d06fed8",
  "parents": [
    "71a7f828fc4f9a0ceb40a39d8e9861db557a3df2"
  ],
  "author": {
    "name": "Madhav Bhardwaj",
    "email": "144702171+Madhav1729@users.noreply.github.com",
    "time": "Wed Jun 10 13:10:25 2026 -0700"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Wed Jun 10 13:11:59 2026 -0700"
  },
  "message": "PR #2074: docs: warn against using \u0026v[0] on empty vectors in MakeSpan\n\nImported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2074\n\nThis PR adds a warning note to the documentation of  absl::MakeSpan  and  absl::MakeConstSpan  in  absl/types/span.h  regarding a common undefined\n  behavior (UB) pitfall when constructing spans from  std::vector  (or other dynamic containers).\n\n  #### The Problem\n\n  Developers frequently try to initialize spans using array-like pointer boundaries:\n\n    absl::MakeSpan(\u0026v[0], v.size());\n\n  However, if  v  is empty, dereferencing  v[0]  to obtain its address is undefined behavior in C++. Similarly, attempting to use  \u0026v[v.size()]  to obtain a range-end pointer also triggers UB.\n\n  #### The Fix\n\n  This documentation update advises developers to use  .data()  instead:\n\n    absl::MakeSpan(v.data(), v.size());\n\n  Or simply pass the container directly to the container overload of  MakeSpan :\n\n    absl::MakeSpan(v);\n\n  This addresses the common pitfall discussed in Issue #1334.\n\n  ### Related Issues:\n\n  Closes #1334\nMerge aaee4d4d7679e1308a19a30d1e2d6e78cadf7618 into 713ec92aa4d23a6e40e4878a5527d93b32939fd6\n\nMerging this change closes #2074\n\nCOPYBARA_INTEGRATE_REVIEW\u003dhttps://github.com/abseil/abseil-cpp/pull/2074 from Madhav1729:docs-makespan-vector-ub aaee4d4d7679e1308a19a30d1e2d6e78cadf7618\nPiperOrigin-RevId: 930034154\nChange-Id: I6a518b39c61ba4050130895aa8dcb5656a95f31c\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "3b291a95d38e1da7723621c4cb6ce5f8f0a28f00",
      "old_mode": 33188,
      "old_path": "absl/types/span.h",
      "new_id": "c33e29411c9f150c02b59edc16f020c29f34ac1b",
      "new_mode": 33188,
      "new_path": "absl/types/span.h"
    }
  ]
}
