diff --git a/src/util.h b/src/util.h index 0719f7370fe64a..59a7622912ebb2 100644 --- a/src/util.h +++ b/src/util.h @@ -346,17 +346,19 @@ inline v8::Local OneByteString(v8::Isolate* isolate, std::string_view str); // Used to be a macro, hence the uppercase name. -template -inline v8::Local FIXED_ONE_BYTE_STRING( - v8::Isolate* isolate, - const char(&data)[N]) { +template + requires(N > 0) +inline v8::Local FIXED_ONE_BYTE_STRING(v8::Isolate* isolate, + const char (&data)[N]) { + CHECK_EQ(data[N - 1], '\0'); return OneByteString(isolate, data, N - 1); } template + requires(N > 0) inline v8::Local FIXED_ONE_BYTE_STRING( - v8::Isolate* isolate, - const std::array& arr) { + v8::Isolate* isolate, const std::array& arr) { + CHECK_EQ(arr[N - 1], '\0'); return OneByteString(isolate, arr.data(), N - 1); }