[all-commits] [llvm/llvm-project] 613634: [libc++] Assert that lengths fit in difference_type

David Benjamin via All-commits all-commits at lists.llvm.org
Sun Mar 19 10:42:43 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 61363445d46d72e2a6c8a821f4146c985404840d
      https://github.com/llvm/llvm-project/commit/61363445d46d72e2a6c8a821f4146c985404840d
  Author: David Benjamin <davidben at google.com>
  Date:   2023-03-19 (Sun, 19 Mar 2023)

  Changed paths:
    M libcxx/include/string_view
    A libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp

  Log Message:
  -----------
  [libc++] Assert that lengths fit in difference_type

This can help flag accidentally passing in negative values into the  `string_view` constructor. This aligns with a similar check in `absl::string_view`.

Fixes https://github.com/llvm/llvm-project/issues/61100

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D145981




More information about the All-commits mailing list