Seg Fault Checking If a Value is a String

43 views
Skip to first unread message

Joel Scarfone

unread,
Feb 24, 2020, 1:35:37 PM2/24/20
to v8-users
V8 Version: 8.0.426.23

Hi all! When updating V8 I found a segmentation fault in tests. I managed to reproduce it with the following code (initialization code stripped, can provide full example upon request):

 Local<String> str = String::NewFromUtf8(isolate, "Hello", v8::NewStringType::kNormal)
.ToLocalChecked(); Local<Value> val = Local<Value>::Cast(str); Persistent<Value> persistentVal(isolate, val); persistentVal.Get(isolate)->IsString(); // seg fault

This worked on previous version. Is this now invalid?

Joel Scarfone

unread,
Feb 24, 2020, 1:51:45 PM2/24/20
to v8-users
The `Local::Cast()` docs mention that it is only available on a subclass, I thought that may have been my issue however updating the example still reproduced the seg fault:

 Local<Value> val = String::NewFromUtf8(isolate, "Hello", v8::NewStringType::kNormal)
.ToLocalChecked(); Persistent<Value> persistentVal(isolate, val); persistentVal.Get(isolate)->IsString(); // seg fault

Ben Noordhuis

unread,
Feb 25, 2020, 5:12:05 PM2/25/20
to v8-users
Can you verify that V8 and your code are compiled using the same
compiler flags? More specifically: defines?

A number of people have reported crashes after recent upgrades that
could be traced back to V8 turning on pointer compression but the
downstream projects missing the requisite V8_COMPRESS_POINTERS and
V8_31BIT_SMIS_ON_64BIT_ARCH defines.

Joel Scarfone

unread,
Feb 25, 2020, 10:13:09 PM2/25/20
to v8-users
Looks like it was the V8_COMPRESS_POINTERS define. I didn't use V8_31BIT_SMIS_ON_64BIT_ARCH however, could you elaborate more on what that define does? 

Jakob Kummerow

unread,
Feb 26, 2020, 5:31:00 AM2/26/20
to v8-users
V8_31BIT_SMIS_ON_64BIT_ARCH is a dependency of V8_COMPRESS_POINTERS, but you don't need to set it separately, as it is implied by the latter. (They are split because we wanted to be able to test the former without the latter.)

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/8a7a1a0e-bb0d-4044-8301-8bb9b7d01b2f%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages