Skip to content

Commit 51d62f7

Browse files
jBarzMylesBorins
authored andcommitted
deps: backport 224d376 from V8 upstream
Orignial commit message: Abort in delete operators that shouldn't be called. Section 3.2 of the C++ standard states that destructor definitions implicitly "use" operator delete functions. Therefore, these operator delete functions must be defined even if they are never called by user code explicitly. http://www.open-std.org/JTC1/SC22/WG21/docs/ cwg_defects.html#261 gcc allows them to remain as empty definitions. However, not all compilers allow this. (e.g. xlc on zOS). This pull request creates definitions which if ever called, result in an abort. R=danno@chromium.org,jochen@chromium.org BUG= LOG=N Review-Url: https://codereview.chromium.org/2588433002 Cr-Commit-Position: refs/heads/master@{#41981} PR-URL: #10546 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 72f3262 commit 51d62f7

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎deps/v8/src/api.cc‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,12 @@ HandleScope::~HandleScope() {
789789
i::HandleScope::CloseScope(isolate_, prev_next_, prev_limit_);
790790
}
791791

792+
V8_NORETURNvoid* HandleScope::operatornew(size_t) {
793+
base::OS::Abort();
794+
abort();
795+
}
796+
797+
void HandleScope::operatordelete(void*, size_t) { base::OS::Abort(); }
792798

793799
intHandleScope::NumberOfHandles(Isolate* isolate) {
794800
returni::HandleScope::NumberOfHandles(
@@ -828,6 +834,12 @@ i::Object** EscapableHandleScope::Escape(i::Object** escape_value) {
828834
return escape_slot_;
829835
}
830836

837+
V8_NORETURNvoid* EscapableHandleScope::operatornew(size_t) {
838+
base::OS::Abort();
839+
abort();
840+
}
841+
842+
void EscapableHandleScope::operatordelete(void*, size_t) { base::OS::Abort(); }
831843

832844
SealHandleScope::SealHandleScope(Isolate* isolate) {
833845
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
@@ -849,6 +861,12 @@ SealHandleScope::~SealHandleScope() {
849861
current->sealed_level = prev_sealed_level_;
850862
}
851863

864+
V8_NORETURNvoid* SealHandleScope::operatornew(size_t) {
865+
base::OS::Abort();
866+
abort();
867+
}
868+
869+
void SealHandleScope::operatordelete(void*, size_t) { base::OS::Abort(); }
852870

853871
voidContext::Enter() {
854872
i::Handle<i::Context> env = Utils::OpenHandle(this);
@@ -2273,6 +2291,12 @@ v8::TryCatch::~TryCatch() {
22732291
}
22742292
}
22752293

2294+
V8_NORETURNvoid* v8::TryCatch::operatornew(size_t) {
2295+
base::OS::Abort();
2296+
abort();
2297+
}
2298+
2299+
void v8::TryCatch::operatordelete(void*, size_t) { base::OS::Abort(); }
22762300

22772301
boolv8::TryCatch::HasCaught() const {
22782302
return !reinterpret_cast<i::Object*>(exception_)->IsTheHole();

0 commit comments

Comments
 (0)